Project

General

Profile

Web services » History » Version 4

Yannick Warnier, 30/06/2010 02:49

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