Project

General

Profile

Web services » History » Version 2

Yannick Warnier, 30/06/2010 02:40

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