Project

General

Profile

Web services » History » Version 1

Yannick Warnier, 30/06/2010 01:58

1 1 Yannick Warnier
h1. Web services
2
3
h2. Documentation for registration.soap.php
4
5
The following documentation gives a complete description of the behaviour of the Chamilo Web Services. These services will have been renamed after Chamilo 1.8.7 to use a more neutral naming convention (starting with WS directly instead of using a platform-specific name).
6
7
We use SOAP as a Web Service application protocol. As such, all communication should be sent using SOAP headers and received using a SOAP parser.
8
9
In order to connect to the web services, one mandatory field is the 'secret_key', which is composed of the $_configuration['secret_key'] value inside of the LMS's main/inc/conf/configuration.php file (which can be changed, it is only used for web services at the time of writing) and the IP address of the caller.
10
11
For example, if I am calling the webservice from an IP address of 134.23.25.34, I will have to generate an SHA1 encrypted string from this IP addess with the secret key. This can be done for example, in PHP, through the command:
12
@$security_key = 'abcdef1234567890';
13
$ip_address = '134.23.25.34';
14
$secret_key = sha1($ip_address.$security_key);@
15
16
The $secret_key variable must then be added to the Web Service call./
17
Calling the SOAP web services scripts is generally done through a URL of this kind:
18
http://chamilo.example.com/main/webservices/registration.soap.php. You can check the
19
list of available functions through a call to
20
http://chamilo.example.com/main/webservices/registration.soap.php?wsdl
21
You can check how your IP is detected by the server, calling the
22
http://chamilo.example.com/main/webservices/testip.php script. The first line can be cut
23
and used as the IP address to put in the $ip_address variable above (just remove the end-
24
of-line character at the end of the first line).
25
1.- DokeosWSCreateUsers
26
This function adds users into dokeos/chamilo, the password param is not encrypted
27
Input params
28
Follow the new structure:
29
$params = array(
30
         'users' =>array(          // array of users params, you can create many users
31
passing arrays of params
32
                array('firstname' => 'Christian',           //required
33
                       'lastname' => 'XXX',                 //required
34
                       'status' => '5', //required, (1 => teacher, 5 => learner)
35
                       'email' => 'XXX@gmail.dom',
36
                              //optional, follow the same format (example@domain.com)
37
                       'loginname' => 'usuario1',           //required
38
                       'password' => '12345',               //required
39
                       'language' => 'spanish',             //optional
40
                       'phone' => '12345678',               //optional
41
                      'expiration_date' => '0000-00-00 00:00:00',
42
                            //optional, follow the same format
43
                      'original_user_id_name' => 'USER',
44
                            //required, field name about original user id
45
                      'original_user_id_value' => '1',
46
                            //required, field value about original user id
47
                      'extra' => array (
48
                            //optional, extra fields about user's extras data,
49
                            //you can insert several extra fields
50
                            array('field_name' => 'direccion',
51
                                   'field_value' => 'Arquimedes 260'),
52
                                   // field name with your field value
53
                            array('field_name' => 'DNI',
54
                                   'field_value' => '416766220')
55
                                   // field name with your field value
56
                      )
57
              )
58
       ),
59
       'secret_key' => sha1('123')
60
       //required, secret key ("your IP address and security key from dokeos")
61
       // encrypted with sha1
62
);
63
Output params
64
The results are shown like follow structure:
65
       array (
66
          0 =>
67
            array (
68
               'original_user_id_value' => string '1',            // original user id that
69
you sent like param
70
               'result' => string '8'                    // new user id from dokeos,
71
return 0 if user in not inserted with sucess
72
              )
73
       )
74
2.- DokeosWSCreateUsersPasswordCrypted
75
This function adds users into dokeos, the password param (your password with a salt) is
76
encrypted. It's very important sent the salt into an extra field param with field_name 'salt',
77
otherwise the user will be able login in
78
Input params
79
Follow the new structure:
80
$params = array(
81
       'users' =>array(
82
              // array of users params, you can create many users passing
83
              // arrays of params
84
              array(
85
                      'firstname' => 'Christian',                // required
86
                      'lastname' => 'XXX',                       // required
87
                     'status' => '5',
88
                            // required, (1 => teacher, 5 => learner)
89
                     'email' => 'XXX@gmail.dom',
90
                            // optional, follow the same format (example@domain.com)
91
                     'loginname' => 'usuarioA',             // required
92
                     'password' => md5('--christian--12345--'),
93
                            // required, it's important to define the salt into
94
                            // an extra field param
95
                     'encrypt_method' => 'md5',
96
                            // required, check if the encrypt is the same
97
                            // as dokeos configuration
98
                     'language' => 'spanish',               // optional
99
                     'phone' => '12345678',                 // optional
100
                     'expiration_date' => '0000-00-00 00:00:00',
101
                            // optional, follow the same format
102
                     'original_user_id_name' => 'USER',
103
                            //required, field name about original user id
104
                     'original_user_id_value' => '10',
105
                            //required, field value about original user id
106
                     'extra' => array (
107
                            //required, you must define at least field name 'salt'
108
                            // with the same value than your encryption
109
                            array('field_name' => 'salt',
110
                                  'field_value' => 'christian'),
111
                            array('field_name' => 'DNI',
112
                                  'field_value' => '123456')
113
                     )
114
              ),
115
              'secret_key' => sha1('123')
116
                     //required, secret key ("your IP address and security key
117
                     // from dokeos") encrypted with sha1
118
       );
119
Output params
120
The results are shown like follow structure:
121
       array
122
          0 =>
123
            array
124
               'original_user_id_value' => string '10'
125
                     // original user id that you sent like param
126
               'result' => string '8'
127
                     // new user id from dokeos, 0 if your operation is failed
128
                     // or a msg about your encrypt method
129
3.- DokeosWSEditUsers
130
This function edits users into dokeos, the password param is not encrypted
131
Input params
132
Follow the new structure:
133
$params = array(
134
       'users' =>array(
135
              // array of users params, you can edit many users passing
136
              // arrays of params
137
              array(
138
                     'original_user_id_value' => '1',
139
                            //required, field value about original user id
140
                     'original_user_id_name' => 'USER',
141
                            //required, field name about original user id
142
                     'firstname' => 'Christian',               //required
143
                     'lastname' => 'XXX',                      //required
144
                     'username' => 'usuario1',                 //required
145
                     'password' => '12345',                    //required
146
                     'email' => 'XXX@gmail.dom',
147
                            //optional, follow the same format (example@domain.com)
148
                     'status' => '5',
149
                            //optional, (1 => teacher, 5 => learner)
150
                     'phone' => '12345678',                    //optional
151
                     'expiration_date' => '0000-00-00 00:00:00',
152
                            //optional, follow the same format
153
                     'extra' => array (
154
                            //optional, extra fields about user's extras data,
155
                            // you can insert several extra fields
156
                            array('field_name' => 'direccion',
157
                                   'field_value' => 'Arquimedes 260'),
158
                                   // field name with your field value
159
                            array('field_name' => 'DNI',
160
                                   'field_value' => '416766220')
161
                                   // field name with your field value
162
                     )
163
             )
164
       ),
165
       'secret_key' => sha1('123')
166
              //required, secret key ("your IP address and security key
167
              // from dokeos") encrypted with sha1
168
);
169
Output params
170
The results are shown like follow structure:
171
       array
172
          0 =>
173
            array
174
               'original_user_id_value' => string '1'
175
                     // original user id that you sent like param
176
               'result' => string '1'
177
                     // '1' if your operation is Ok, '0' otherwise
178
4.- DokeosWSEditUsersPasswordCrypted
179
This function edits users into dokeos, if you edit password it must be encrypted with sha1
180
(password with a salt), and don't forget define the salt into extra field with field name 'salt',
181
otherwise the user will be able log in.
182
Input params
183
Follow the new structure:
184
$params = array(
185
       'users' =>array( // array of users params, you can edit many users
186
passing arrays of params
187
               array(
188
                      'original_user_id_value' => '10',
189
                              //required, field value about original user id
190
                      'original_user_id_name' => 'USER',
191
                              //required, field name about original user id
192
                      'firstname' => 'Christian',             // required
193
                      'lastname' => 'XXX',                    // required
194
                      'username' => 'usuarioA',               // required
195
                      'password' => md5('--christian--12345--'),
196
                              // required, it's important to define the salt into
197
                              // an extra field param
198
                      'encrypt_method' => 'md5',
199
                              // required, check if the encrypt is the same than
200
                              // dokeos configuration
201
                      'email' => 'XXX@gmail.dom',
202
                              // optional, follow the same format (example@domain.com)
203
                      'status' => '5', // required, (1 => teacher, 5 => learner)
204
                      'phone' => '12345678', // optional
205
                      'expiration_date' => '0000-00-00 00:00:00',
206
                              // optional, follow the same format
207
                      'extra' => array (
208
                              //required, you must define at least field name 'salt'
209
                              // with the same value than your encryption
210
                      array('field_name' => 'salt',
211
                              'field_value' => 'christian'),
212
                      array('field_name' => 'DNI',
213
                              'field_value' => '123456')
214
              )
215
       ),
216
       'secret_key' => sha1('123') //required, secret key ("your IP address and
217
security key from dokeos") encrypted with sha1
218
);
219
Output params
220
The results are shown like follow structure:
221
array
222
   0 =>
223
     array
224
        'original_user_id_value' => string '10'
225
               // original user id that you sent like param
226
        'result' => string '8'
227
               // new user id from dokeos, 0 if your operation is failed
228
               // or a msg about your encrypt method
229
5.- DokeosWSDeleteUsers
230
This function only disable users into dokeos, if you want delete from database you can
231
delete it from user list into your dokeos portal
232
Input params
233
Follow the new structure:
234
$params = array(
235
       'users' =>array(
236
              // array of users params, you can delete many users passing
237
              // arrays of params
238
              array(
239
                    'original_user_id_name' => 'USER',
240
                           //required, field name about original user id
241
                    'original_user_id_value' => '1',
242
                           //required, field value about original user id
243
             )
244
       ),
245
       'secret_key' => sha1('123') //required, secret key ("your IP address and
246
security key from dokeos") encrypted with sha1
247
);
248
Output params
249
The results are shown like follow structure:
250
array
251
   0 =>
252
     array
253
        'original_user_id_value' => string '1'
254
              // original user id that you sent like param
255
        'result' => string '1'
256
              // '1' if your operation is Ok, '0' otherwise
257
6.- DokeosWSCreateCourse
258
This function creates courses into dokeos
259
Input params
260
Follow the new structure:
261
$params = array(
262
       'courses' =>array(
263
              // array of courses params, this depend your memory limit,
264
              // it is recommended not passing 3 courses
265
              array(
266
                    'title' => 'Religion',         // required
267
                    'category_code' => 'LANG',     // required (LANG,PROJ)
268
                    'wanted_code' => '',
269
                           // optional, if it's not defined dokeos will
270
                           // generate it
271
                    'tutor_name' => 'Christian Fasanando', // optional
272
                    'course_language' => 'spanish',            // optional
273
                    'original_course_id_name' => 'CURSO',
274
                           //required, field name about original course id
275
                    'original_course_id_value' => '1',
276
                           //required, field value about original course id
277
                    'extra' => array (
278
                           array('field_name' => 'edicion',
279
                                  'field_value' => 'Arquimedes 260'),
280
                           array('field_name' => 'libros',
281
                                  'field_value' =>'XXX')
282
                    )
283
             )
284
       ),
285
       'secret_key' => sha1('123')
286
              //required, secret key ("your IP address
287
              //and security key from dokeos") encrypted with sha1
288
);
289
Output params
290
The results are shown like follow structure:
291
array
292
   0 =>
293
     array
294
        'original_course_id_value' => string '1'
295
              // original course id that you sent like param
296
        'result' => string 'RELIGION'
297
       // new course code from dokeos, '0' if the operation has been failed
298
7.- DokeosWSCreateCourseByTitle
299
This function creates courses into dokeos by title
300
Input params
301
Follow the new structure:
302
$params = array(
303
       'courses' =>array(
304
              // array of courses params, this depend your memory limit,
305
              //it's recommended not passing 3 courses
306
              array(
307
                     'title' => 'Religion',         // required
308
                     'tutor_name' => 'Christian Fasanando', // optional
309
                     'original_course_id_name' => 'CURSO',
310
                           //required, field name about original course id
311
                     'original_course_id_value' => '1',
312
                           //required, field value about original course id
313
                     'extra' => array (
314
                           array('field_name' => 'edicion',
315
                                  'field_value' => Arquimedes 260'),
316
                           array('field_name' => 'libros',
317
                                  'field_value' =>'XXX')
318
                     )
319
             )
320
       ),
321
       'secret_key' => sha1('123')
322
              //required, secret key ("your IP address and security key
323
              // from dokeos") encrypted with sha1
324
);
325
Output params
326
The results are shown like follow structure:
327
array
328
   0 =>
329
     array
330
        'original_course_id_value' => string '1'
331
              // original course id that you sent like param
332
        'result' => string 'RELIGION'
333
              // new course code from dokeos, '0' if the operation has been failed
334
8.- DokeosWSEditCourse
335
This function edits courses into dokeos
336
Input params
337
Follow the new structure:
338
$params = array(
339
       'courses' =>array(
340
              // array of courses params, this depend your memory limit,
341
              // it's recommended not passing 3 courses
342
              array(
343
                    'tutor_id' => '1',              // required
344
                    'title' => 'Religion',          // required
345
                    'category_code' => 'LANG',      // required
346
                    'department_name' => '',        // optional
347
                    'department_url' => '',         // optional
348
                    'course_language' => 'english',       // optional
349
                    'visibility' => '3',
350
                           // optional ('0' = closed,'1' = private access,
351
                           // '2' = access allowed for users registered on
352
                           // the platform, '3' = access allowed for
353
                           // the whole world )
354
                    'subscribe' => '1', // optional ('0' = denied, '1' = allowed)
355
                    'unsubscribe' => '0', //optional ('0' = denied, '1' = allowed)
356
                    'visual_code' => '',
357
                           // optional, if it's not defined
358
                           // dokeos will be generate it
359
                    'original_course_id_name' => 'CURSO',
360
                           //required, field name about original course id
361
                    'original_course_id_value' => '1',
362
                           //required, field value about original course id
363
                    'extra' => array (        //optional
364
                           array('field_name' => 'edicion',
365
                                  'field_value' => 'Arquimedes 260'),
366
                           array('field_name' => 'libros',
367
                                  'field_value' =>'XXX')
368
                    )
369
             )
370
       ),
371
       'secret_key' => sha1('123') //required, secret key ("your IP address and
372
security key from dokeos") encrypted with sha1
373
);
374
Output params
375
The results are shown like follow structure:
376
array
377
   0 =>
378
     array
379
        'original_course_id_value' => string '1'
380
              // original course id that you sent like param
381
        'result' => string '1'
382
              // '1' if the operation is OK, '0' otherwise
383
9.- DokeosWSDeleteCourse
384
This function set visibility to '0', this not allow a user to access it, if you want remove from
385
database you must delete from courses list into your dokeos portal
386
Input params
387
Follow the new structure:
388
$params = array(
389
       'courses' =>array(
390
              // array of courses params, this depend your memory limit,
391
              // it's recommended not passing 3 courses
392
              array(
393
                     'original_course_id_value' => '1',
394
                              //required, field value about original course id
395
                     'original_course_id_name' => 'CURSO',
396
                              //required, field name about original course id
397
             )
398
       ),
399
       'secret_key' => sha1('123')
400
              //required, secret key ("your IP address and security key
401
              // from dokeos") encrypted with sha1
402
);
403
Output params
404
The results are shown like follow structure:
405
array
406
   0 =>
407
     array
408
        'original_course_id_value' => string '1'
409
              // original course id that you sent like param
410
        'result' => string '1'
411
              // '1' if the operation is OK, '0' otherwise
412
10.- DokeosWSCreateSession
413
This function creates sessions into dokeos
414
Input params
415
Follow the new structure:
416
$params = array(
417
       'sessions' =>array(                    // array of session params, you can create
418
many session
419
              array(
420
                     'name' => 'SESION3',             //required
421
                     'year_start' => '2000', // required if nolimit param is '1'
422
                     'month_start' => '11', // required if nolimit param is '1'
423
                     'day_start' => '10', // required if nolimit param is '1'
424
                     'year_end' => '2001', //required if nolimit param is '1'
425
                     'month_end' => '12',      //required if nolimit param is '1'
426
                     'day_end' => '11',        //required if nolimit param is '1'
427
                     'nb_days_acess_before' => '0',
428
                     // optional, define access delays of the coach (days before)
429
                     'nb_days_acess_after' => '0',
430
                     // optional, define access delays of the coach (days after)
431
                     'nolimit' => '0',
432
                            // required, 0 = no limit time, 1 = limit time
433
                     'user_id' => '3', // required, a user id from dokeos
434
                     'original_session_id_name' => 'SESION',
435
                            //required, field name about original session id
436
                     'original_session_id_value' =>'3',
437
                            //required, field value about original session id
438
                     'extra' => array ( // optional
439
                            array('field_name' => 'edicion',
440
                                   'field_value' => 'Arquimedes 260'),
441
                            array('field_name' => 'libros',
442
                                   'field_value' =>'XXX')
443
                     )
444
             )
445
       ),
446
       'secret_key' => sha1('123')
447
              //required, secret key ("your IP address and security key from
448
              // dokeos") encrypted with sha1
449
);
450
Output params
451
The results are shown like follow structure:
452
array
453
   0 =>
454
     array
455
        'original_session_id_value' => string '3'
456
              // original session id that you sent like param
457
        'result' => string '11'
458
              // new session id from dokeos, '0' if the operation has been failed
459
11.- DokeosWSEditSession
460
This function edits a session into dokeos
461
Input params
462
Follow the new structure:
463
$params = array(
464
       'sessions' =>array( // array of session params, you can edit many session
465
              array(
466
                     'name' => 'SESION3',      //required
467
                     'year_start' => '2000', // required if nolimit param is '1'
468
                     'month_start' => '11', // required if nolimit param is '1'
469
                     'day_start' => '10',     // required if nolimit param is '1'
470
                    'year_end' => '2001',     //required if nolimit param is '1'
471
                    'month_end' => '12',      //required if nolimit param is '1'
472
                    'day_end' => '11',        //required if nolimit param is '1'
473
                    'nb_days_acess_before' => '0',
474
                    // optional, define access delays of the coach (days before)
475
                    'nb_days_acess_after' => '0',
476
                    // optional, define access delays of the coach (days after)
477
                    'nolimit' => '0',
478
                           // required, 0 = no limit time, 1 = limit time
479
                    'user_id' => '3', // required, a user id from dokeos
480
                    'original_session_id_name' => 'SESION',
481
                           //required, field name about original session id
482
                    'original_session_id_value' =>'3',
483
                           //required, field value about original session id
484
                    'extra' => array ( // optional
485
                           array('field_name' => 'edicion',
486
                                  'field_value' => 'Arquimedes 260'),
487
                           array('field_name' => 'libros', 'field_value' =>'XXX')
488
                    )
489
             )
490
       ),
491
       'secret_key' => sha1('123')
492
              //required, secret key ("your IP address and security key
493
              //from dokeos") encrypted with sha1
494
);
495
Output params
496
The results are shown like follow structure:
497
array
498
   0 =>
499
     array
500
        'original_session_id_value' => string '3'
501
              // original session id that you sent like param
502
        'result' => string '1'
503
              // '1' if the operation is OK, '0' otherwise
504
12.- DokeosWSDeleteSession
505
This function deletes a session from database into dokeos
506
Input params
507
Follow the new structure:
508
$params = array(
509
       'sessions' =>array(
510
              // array of session params, you can delete many session
511
              array(
512
                    'original_session_id_value' =>'3',
513
                           //required, field value about original session id
514
                    'original_session_id_name' => 'SESION',
515
                           //required, field name about original session id
516
             )
517
       ),
518
       'secret_key' => sha1('123')
519
              //required, secret key ("your IP address and security key
520
              //from dokeos") encrypted with sha1
521
);
522
Output params
523
The results are shown like follow structure:
524
array
525
   0 =>
526
     array
527
        'original_session_id_value' => string '3'
528
              // original session id that you sent like param
529
        'result' => string '1'
530
              // '1' if the operation is OK, '0' otherwise
531
13.- DokeosWSSubscribeUserToCourse
532
This function suscribe many users to a course into dokeos
533
Input params
534
Follow the new structure:
535
$params = array(
536
       'userscourses' =>array(
537
              // array of userscourses params, you can suscribe many users
538
              //into many courses
539
              array(
540
                     'original_user_id_values' => array('1','2'),
541
                     // required, array of field value about original user id
542
                     'original_user_id_name' => 'USER',
543
                           //required, field name about original user id
544
                     'original_course_id_value' => '1',
545
                           //required, field value about original course id
546
                     'original_course_id_name' => 'CURSO',
547
                           //required, field name about original course id
548
              )
549
       ),
550
       'secret_key' => sha1('123')
551
              //required, secret key ("your IP address and security key
552
              // from dokeos") encrypted with sha1
553
);
554
Output params
555
The results are shown like follow structure:
556
$output[] = array(
557
       'original_user_id_value' =>$orig_user_id_value[$i],
558
       'original_course_id_value' =>$orig_course_id_value[$i],
559
       'result' => $results[$i]);
560
array
561
   0 =>
562
     array
563
        'original_user_id_value' => string '1,2'
564
              // original users id that you sent like param
565
        'original_course_id_value' => string '1'
566
              // original course id that you sent like param
567
        'result' => string '1'
568
              // '1' if the operation is OK, '0' otherwise
569
14.- DokeosWSUnSubscribeUserFromCourse
570
This function unsuscribe many users from courses into dokeos
571
Input params
572
Follow the new structure:
573
$params = array(
574
       'userscourses' =>array(               // array of userscourses params, you can
575
unsuscribe many users from many courses
576
              array(
577
                    'original_user_id_values' => array('1','2'),
578
                           // required, array of field value about original user id
579
                    'original_user_id_name' => 'USER',
580
                           //required, field name about original user id
581
                    'original_course_id_value' => '1',
582
                           //required, field value about original course id
583
                    'original_course_id_name' => 'CURSO',
584
                           //required, field name about original course id
585
             )
586
       ),
587
       'secret_key' => sha1('123') //required, secret key ("your IP address and
588
security key from dokeos") encrypted with sha1
589
);
590
Output params
591
The results are shown like follow structure:
592
array
593
   0 =>
594
     array
595
        'original_user_id_value' => string '1,2'
596
              // original users id that you sent like param
597
       'original_course_id_value' => string '1'
598
              // original course id that you sent like param
599
       'result' => string '1'
600
              // '1' if the operation is OK, '0' otherwise
601
15.- DokeosWSSuscribeUsersToSession
602
This function suscribe many users to sessions into dokeos
603
Input params
604
Follow the new structure:
605
$params = array(
606
       'userssessions' =>array(
607
              // array of userssessions params, you can suscribe many users
608
              //into many sessions
609
              array(
610
                     'original_user_id_values' => array('1','2'),
611
                           // required, array of field value about original user id
612
                     'original_user_id_name' => 'USER',
613
                           //required, field name about original user id
614
                     'original_session_id_value' => '1',
615
                           //required, field value about original session id
616
                     'original_session_id_name' => 'SESION',
617
                           //required, field name about original session id
618
             )
619
       ),
620
       'secret_key' => sha1('123')
621
              //required, secret key ("your IP address and security key
622
              // from dokeos") encrypted with sha1
623
);
624
Output params
625
The results are shown like follow structure:
626
array
627
   0 =>
628
     array
629
        'original_user_id_value' => string '1,2'
630
              // original users id that you sent like param
631
       'original_session_id_value' => string '1'
632
              // original session id that you sent like param
633
       'result' => string '1'
634
              // '1' if the operation is OK, '0' otherwise
635
16.- DokeosWSUnsuscribeUsersFromSession
636
This function unsuscribe many users from sessions into dokeos
637
Input params
638
Follow the new structure:
639
$params = array(
640
       'userssessions' =>array(
641
              // array of userssessions params, you can unsuscribe many users
642
              // from many sessions
643
              array(
644
                     'original_user_id_values' => array('1','2'),
645
                           // required, array of field value about original user id
646
                     'original_user_id_name' => 'USER',
647
                           //required, field name about original user id
648
                     'original_session_id_value' => '1',
649
                           //required, field value about original session id
650
                     'original_session_id_name' => 'SESION',
651
                           //required, field name about original session id
652
             )
653
       ),
654
       'secret_key' => sha1('123')
655
              //required, secret key ("your IP address and security key
656
              // from dokeos") encrypted with sha1
657
);
658
Output params
659
The results are shown like follow structure:
660
array
661
   0 =>
662
     array
663
        'original_user_id_values' => string '1,2'
664
              // original users id that you sent like param
665
        'original_session_id_value' => string '1'
666
              // original session id that you sent like param
667
        'result' => string '1'
668
              // '1' if the operation is OK, '0' otherwise
669
17.- DokeosWSSuscribeCoursesToSession
670
This function suscribe many courses to sessions into dokeos
671
Input params
672
Follow the new structure:
673
$params = array(
674
       'coursessessions' =>array(
675
              // array of coursessessions params, you can suscribe many
676
              // courses from many sessions
677
              array(
678
                     'original_course_id_values' => array('1','2'),
679
                     // required, array of field values about original course id
680
                     'original_course_id_name' => 'CURSO',
681
                     //required, field name about original course id
682
                     'original_session_id_value' => '1',
683
                     //required, field value about original session id
684
                     'original_session_id_name' => 'SESION',
685
                     //required, field name about original session id
686
             )
687
       ),
688
       'secret_key' => sha1('123')
689
              //required, secret key ("your IP address
690
              // and security key from dokeos") encrypted with sha1
691
);
692
Output params
693
The results are shown like follow structure:
694
array
695
   0 =>
696
     array
697
        'original_course_id_values' => string '1,2'
698
              // original courses id that you sent like param
699
       'original_session_id_value' => string '1'
700
              // original session id that you sent like param
701
       'result' => string 'RELIGION,MATE'
702
              // deparment urls of courses suscribed, '0' otherwise
703
18.- DokeosWSUnsuscribeCoursesFromSession
704
This function unsuscribe many courses from sessions into dokeos
705
Input params
706
Follow the new structure:
707
$params = array(
708
       'coursessessions' =>array(
709
                    // array of coursessessions params, you can unsuscribe
710
                    //many courses from many sessions
711
              array(
712
                    'original_course_id_values' => array('1','2'),
713
                    // required, array of field values about original course id
714
                    'original_course_id_name' => 'CURSO',
715
                    //required, field name about original course id
716
                    'original_session_id_value' => '1',
717
                    //required, field value about original session id
718
                    'original_session_id_name' => 'SESION',
719
                    //required, field name about original session id
720
             )
721
       ),
722
       'secret_key' => sha1('123')
723
              //required, secret key ("your IP address and security key
724
              // from dokeos") encrypted with sha1
725
);
726
Output params
727
The results are shown like follow structure:
728
array
729
   0 =>
730
     array
731
       'original_course_id_values' => string       '1,2'
732
              // original courses id that you      sent like param
733
       'original_session_id_value' => string       '1'
734
              // original session id that you      sent like param
735
       'result' => string '1'
736
              // '1' if the operation is OK,       '0' otherwise
737
19.- DokeosWSCourseDescription
738
This function return categories list from course description, if the value is a string '' it
739
means there are not title and content by category. Actually exits only 8 categories what you
740
can modify title and content, see course description tool in your portal dokeos
741
Input params
742
Follow the new structure:
743
$params = array(
744
       'original_course_id_name' => 'CURSO',
745
              // required, field name about original course id
746
       'original_course_id_value' => '2',
747
              // required, field value about original course id
748
       'secret_key' => sha1('123')
749
              // required, secret key ("your IP address and security key
750
              // from dokeos") encrypted with sha1
751
 );
752
Results
753
Return categories list about course description
754
20.- DokeosWSEditCourseDescription
755
This function modify title and content about categories from course description
756
Input params
757
Follow the new structure:
758
$params = array(
759
       'course_desc' =>array(
760
              // array course description params, you can create modify
761
              // many titles and contents
762
              array(
763
                     'course_desc_id' => '1',
764
                            //required, category id from course description (1-8),
765
                            // see results of DokeosWSCourseDescription function
766
                            //for more information
767
                     'course_desc_title' => 'Descripcion',
768
                            //required, title about a category you want modify
769
                     'course_desc_content' => 'descripcion mod',
770
                            //required, content about a category you want modify
771
                     'original_course_id_name' => 'CURSO',
772
                            //required, field name about original course id
773
                      'original_course_id_value' => '2'
774
                             //required, field value about original course id
775
             )
776
        ),
777
        'secret_key' => sha1('123')
778
              //required, secret key ("your IP address and security key
779
              //from dokeos") encrypted with sha1
780
);
781
Output params
782
The results are shown like follow structure:
783
array
784
   0 =>
785
     array
786
        'original_course_id_value' => string '10'
787
              // original course id that you sent like param
788
        'result' => string '1'
789
              // '1' if operation is OK, 0 otherwise
790
NOTE: In all functions above if your secret key param is incorrect they'll return an array
791
empty
792
21.- DokeosWSCreateUserPasswordCrypted
793
This function adds only a user into dokeos, the password param (your password with a
794
salt) is encrypted. It's very important sent the salt into an extra field param with
795
field_name 'salt', otherwise the user will be able login in .
796
Input params
797
Follow the new structure:
798
$params =
799
        array(
800
              'firstname' => 'Christian',                 // required
801
              'lastname' => 'XXX',                        // required
802
              'status' => '5',
803
                      // required, (1 => teacher, 5 => learner)
804
              'email' => 'XXX@gmail.dom',
805
                      // optional, follow the same format (example@domain.com)
806
              'loginname' => 'usuarioIV',                 // required
807
              'password' => md5('--christian--12345--'),
808
                      // required, it's important to define the salt
809
                      // into an extra field param
810
              'encrypt_method' => 'md5',          // required, check if the encrypt
811
                      // is the same than dokeos configuration
812
              'language' => 'spanish',                    // optional
813
              'phone' => '12345678',                      // optional
814
              'expiration_date' => '0000-00-00 00:00:00',
815
                      // optional, follow the same format
816
              'original_user_id_name' => 'USER',
817
                      //required, field name about original user id
818
              'original_user_id_value' => 'A5',
819
                      //required, field value about original user id
820
               'extra' => array (
821
                      //required, you must define at least field name 'salt'
822
                      // with the same value than your encryption
823
                      array(
824
                             'field_name' => 'salt',
825
                             'field_value' => 'christian'),
826
                      array(
827
                             'field_name' => 'DNI',
828
                             'field_value' => '123456')
829
         ),
830
         'secret_key' => sha1('123')
831
               //required, secret key ("your IP address and security key
832
               // from dokeos") encrypted with sha1
833
         );
834
Output params
835
A string about result:
836
-1 - Secret key is incorrect
837
        new user id from dokeos - If the operation is OK
838
0 - If the operation has failed
839
22.- DokeosWSEditUserPasswordCrypted
840
This function edits only a user into dokeos, if you edit password it must be encrypted with
841
sha1 (password with a salt), and don't forget define the salt into extra field with field name
842
'salt', otherwise the user will be able log in.
843
Input params
844
Follow the new structure:
845
$params =
846
         array(
847
               'original_user_id_value' => '10',
848
                      //required, field value about original user id
849
               'original_user_id_name' => 'USER',
850
                      //required, field name about original user id
851
               'firstname' => 'Christian',               // required
852
               'lastname' => 'XXX',                      // required
853
               'username' => 'usuarioA',                 // required
854
               'password' => md5('--christian--12345--'),
855
                      // required, it's important to define the salt into
856
                      // an extra field param
857
               'encrypt_method' => 'md5',
858
               // required, check if the encrypt is the same
859
               // than dokeos configuration
860
               'email' => 'XXX@gmail.dom',
861
               // optional, follow the same format (example@domain.com)
862
               'status' => '5', // required, (1 => teacher, 5 => learner)
863
               'phone' => '12345678', // optional
864
               'expiration_date' => '0000-00-00 00:00:00',
865
                      // optional, follow the same format
866
               'extra' => array (
867
                      //required, you must define at least field name 'salt'
868
                     // with the same value than your encryption
869
                     array('field_name' => 'salt',
870
                           'field_value' => 'christian'),
871
                     array('field_name' => 'DNI',
872
                           'field_value' => '123456')
873
              ),
874
              'secret_key' => sha1('123')
875
                     // required, secret key ("your IP address and security
876
                     // key from dokeos") encrypted with sha1
877
);
878
Output params
879
A string about result:
880
-1 - Secret key is incorrect
881
 1 - If the operation is OK
882
 0 - If the operation has failed
883
23.- DokeosWSCreateUser
884
This function adds only a user into dokeos, the password param is not encrypted
885
Input params
886
Follow the new structure:
887
$params =
888
       array(
889
              'firstname' => 'Christian',            //required
890
              'lastname' => 'XXX',                   //required
891
              'status' => '5',
892
                     //required, (1 => teacher, 5 => learner)
893
              'email' => 'XXX@gmail.dom',
894
                     //optional, follow the same format (example@domain.com)
895
              'loginname' => 'usuario1',             //required
896
              'password' => '12345',                 //required
897
              'language' => 'spanish',               //optional
898
              'phone' => '12345678',                 //optional
899
              'expiration_date' => '0000-00-00 00:00:00',
900
                     //optional, follow the same format
901
              'original_user_id_name' => 'USER',
902
                     //required, field name about original user id
903
              'original_user_id_value' => '1',
904
                     //required, field value about original user id
905
              'extra' => array (
906
                     //optional, extra fields about user's extras data,
907
                     //you can insert several extra fields
908
                     array('field_name' => 'direccion',
909
                           'field_value' => 'Arquimedes 260'),
910
                           // field name with your field value
911
                     array('field_name' => 'DNI',
912
                           'field_value' => '416766220')
913
                           // field name with your field value
914
              ),
915
       'secret_key' => sha1('123')
916
              //required, secret key ("your IP address and security key
917
              // from dokeos") encrypted with sha1
918
     );
919
Output params
920
A string about result:
921
          -1 - Secret key is incorrect
922
            new user id from dokeos - If the operation is OK
923
          0 - If the operation has failed
924
24.- DokeosWSEditUser
925
This function edits only a user into dokeos, the password param is not encrypted
926
Input params
927
Follow the new structure:
928
$params =
929
       array(
930
              'original_user_id_value' => '1',
931
                     //required, field value about original user id
932
              'original_user_id_name' => 'USER',
933
                     //required, field name about original user id
934
              'firstname' => 'Christian',             //required
935
              'lastname' => 'XXX',                    //required
936
              'username' => 'usuario1',               //required
937
              'password' => '12345',                  //required
938
              'email' => 'XXX@gmail.dom',
939
                     //optional, follow the same format (example@domain.com)
940
              'status' => '5',
941
                     //optional, (1 => teacher, 5 => learner)
942
              'phone' => '12345678',                  //optional
943
              'expiration_date' => '0000-00-00 00:00:00',
944
                     //optional, follow the same format
945
              'extra' => array (
946
                     //optional, extra fields about user's extras data,
947
                     // you can insert several extra fields
948
                     array('field_name' => 'direccion',
949
                            'field_value' => 'Arquimedes 260'),
950
                            // field name with your field value
951
                     array('field_name' => 'DNI',
952
                            'field_value' => '416766220')
953
                            // field name with your field value
954
              ),
955
              'secret_key' => sha1('123')
956
                     //required, secret key ("your IP address and security key
957
                     // from dokeos") encrypted with sha1
958
           );
959
Output params
960
A string about result:
961
          -1 - Secret key is incorrect
962
            1 - If the operation is OK
963
          0 - If the operation has failed
964
25.- DokeosWSDeleteUser
965
This function only disable only a user into dokeos, if you want delete from database you
966
can delete it from user list into your dokeos portal
967
Input params
968
Follow the new structure:
969
$params =
970
       array(
971
               'original_user_id_name' => 'USER',
972
                     //required, field name about original user id
973
               'original_user_id_value' => '1',
974
                     //required, field value about original user id
975
               'secret_key' => sha1('123')
976
                     //required, secret key ("your IP address and security key
977
                     // from dokeos") encrypted with sha1
978
             );
979
Output params
980
A string about result:
981
          -1 - Secret key is incorrect
982
            1 - If the operation is OK
983
          0 - If the operation has failed