Project

General

Profile

Web services » History » Version 3

Yannick Warnier, 30/06/2010 02:42

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