Project

General

Profile

Web services » History » Version 10

Yannick Warnier, 20/06/2011 07:00

1 6 Yannick Warnier
h1. Web services
2
3 2 Yannick Warnier
{{>toc}}
4 3 Yannick Warnier
5 10 Yannick Warnier
h2. Introduction
6 1 Yannick Warnier
7 6 Yannick Warnier
The following documentation gives a complete description of the behaviour of the Chamilo Web Services.
8 1 Yannick Warnier
We use SOAP as a Web Service application protocol (although it would be easy to extend to other protocols). As such, all communication should be sent using SOAP headers and received using a SOAP parser.
9 10 Yannick Warnier
10
To use Chamilo's [[webservices from systems written in python]], you can use web2py as described in this link.
11
12
h2. Chamilo > 1.8.7
13
14 6 Yannick Warnier
15
The 'secret_key' is a mandatory parameter to connect to the web services. It 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.
16
17
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:
18
<pre>$security_key = 'abcdef1234567890';
19
$ip_address = '134.23.25.34';
20
$secret_key = sha1($ip_address.$security_key);</pre>
21
22
The $secret_key variable must then be added to the Web Service call.
23
24
Calling the SOAP web services scripts is generally done through a URL of this kind:
25
http://campus.chamilo.org/main/webservices/soap.php. You can check the list of available functions through a call to http://campus.chamilo.org/main/webservices/soap.php?wsdl
26
27
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
28
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).
29
30 8 Yannick Warnier
h3. External identifiers
31
32
For most Web Services provided, an identifier and a value are expected by Chamilo. For example, if you import your users from an Oracle database, you might use a unique ID coming from the *LUSERID* field and worth *1504*. When calling Chamilo, we assume you will give us the user ID as you know it in *your* system. That is, we expect you'll give us *LUSERID* as the *user_id_field_name* parameter, and *1504* as the *user_id_value*.
33
34
When you do that, Chamilo is able to find, inside its database, which user you are referencing, because Chamilo kept this reference at the time of calling.
35
36 6 Yannick Warnier
h3. WSUser.DisableUser
37
38
Disables one user
39 1 Yannick Warnier
40 8 Yannick Warnier
h4. Input
41
42 1 Yannick Warnier
<pre>
43 8 Yannick Warnier
array(
44
 'secret_key' => 'abcdef1234567890',
45
 'user_id_field_name' => 'external_user',
46
 'user_id_value' => '1504',
47
);
48 1 Yannick Warnier
</pre>
49
50 8 Yannick Warnier
h4. Output
51
52 6 Yannick Warnier
<pre>
53 8 Yannick Warnier
nothing (or error message)
54 6 Yannick Warnier
</pre>
55
56
h3. WSUser.DisableUsers
57 1 Yannick Warnier
58
Disables several users in one call.
59 6 Yannick Warnier
60 8 Yannick Warnier
h4. Input
61
62 1 Yannick Warnier
<pre>
63 8 Yannick Warnier
array(
64
'secret_key' => 'abcdef1234567890',
65
 array( 
66
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
67
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
68
 )
69
);
70 6 Yannick Warnier
</pre>
71 1 Yannick Warnier
72 8 Yannick Warnier
h4. Output
73
74 1 Yannick Warnier
<pre>
75 8 Yannick Warnier
array(
76
  0=>array('code'=>0,'message'=>'Operation was successful'),
77
  1=>array('code'=>0,'message'=>'Operation was successful'),
78
);
79 6 Yannick Warnier
</pre>
80
81
h3. WSUser.EnableUser
82
83 7 Yannick Warnier
Enables one user
84 6 Yannick Warnier
85 9 Yannick Warnier
h4. Input
86
87 1 Yannick Warnier
<pre>
88 9 Yannick Warnier
array(
89
 'secret_key' => 'abcdef1234567890',
90
 'user_id_field_name' => 'external_user',
91
 'user_id_value' => '1504',
92
);
93 1 Yannick Warnier
</pre>
94
95 9 Yannick Warnier
h4. Output
96
97 6 Yannick Warnier
<pre>
98 9 Yannick Warnier
nothing (or error message)
99 7 Yannick Warnier
</pre>
100 6 Yannick Warnier
101 7 Yannick Warnier
h3. WSUser.EnableUsers
102 1 Yannick Warnier
103
Enables several users in one call.
104 6 Yannick Warnier
105 9 Yannick Warnier
h4. Input
106
107 1 Yannick Warnier
<pre>
108 9 Yannick Warnier
array(
109
'secret_key' => 'abcdef1234567890',
110
 array( 
111
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
112
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
113
 )
114
);
115 6 Yannick Warnier
</pre>
116 1 Yannick Warnier
117 9 Yannick Warnier
h4. Output
118
119 1 Yannick Warnier
<pre>
120 9 Yannick Warnier
array(
121
  0=>array('code'=>0,'message'=>'Operation was successful'),
122
  1=>array('code'=>0,'message'=>'Operation was successful'),
123
);
124 7 Yannick Warnier
</pre>
125 1 Yannick Warnier
126
h3. WSUser.DeleteUser
127 6 Yannick Warnier
128 1 Yannick Warnier
Deletes one user
129
130 9 Yannick Warnier
h4. Input
131
132 1 Yannick Warnier
<pre>
133 9 Yannick Warnier
array(
134
 'secret_key' => 'abcdef1234567890',
135
 'user_id_field_name' => 'external_user',
136
 'user_id_value' => '1504',
137
);
138 6 Yannick Warnier
</pre>
139
140 9 Yannick Warnier
h4. Output
141
142 7 Yannick Warnier
<pre>
143 9 Yannick Warnier
nothing (or error message)
144 1 Yannick Warnier
</pre>
145 6 Yannick Warnier
146 1 Yannick Warnier
h3. WSUser.DeleteUsers
147
148
Deletes several users in one call
149
150 9 Yannick Warnier
h4. Input
151
152 1 Yannick Warnier
<pre>
153 9 Yannick Warnier
array(
154
'secret_key' => 'abcdef1234567890',
155
 array( 
156
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
157
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
158
 )
159
);
160 1 Yannick Warnier
</pre>
161 6 Yannick Warnier
162 9 Yannick Warnier
h4. Output
163
164 6 Yannick Warnier
<pre>
165 9 Yannick Warnier
array(
166
  0=>array('code'=>0,'message'=>'Operation was successful'),
167
  1=>array('code'=>0,'message'=>'Operation was successful'),
168
);
169 1 Yannick Warnier
</pre>
170
171
h3. WSUser.CreateUser
172
173
Creates one user
174
175 9 Yannick Warnier
h4. Input
176
177 1 Yannick Warnier
<pre>
178 9 Yannick Warnier
array(
179
'secret_key' => 'xsd:string',
180
'firstname' => 'xsd:string',
181
'lastname' => 'xsd:string',
182
'status' => 'xsd:int',
183
'loginname' => 'xsd:string',
184
'password' => 'xsd:string',
185
'encrypt_method' => 'xsd:string',
186
'user_id_field_name' => 'xsd:string',
187
'user_id_value' => 'xsd:string',
188
'visibility' => 'xsd:int',
189
'email' => 'xsd:string',
190
'language' => 'xsd:string',
191
'phone' => 'xsd:string',
192
'expiration_date' => 'xsd:string',
193
'extras' => 'tns:extra_field[]'
194
);
195 6 Yannick Warnier
</pre>
196 1 Yannick Warnier
197 9 Yannick Warnier
h4. Output
198
199 1 Yannick Warnier
<pre>
200 9 Yannick Warnier
int new_user_id
201 1 Yannick Warnier
</pre>
202
203
h3. WSUser.CreateUsers
204
205
Creates several users in one call.
206
207 9 Yannick Warnier
h4. Input
208
209 1 Yannick Warnier
<pre>
210 9 Yannick Warnier
array(
211
 'secret_key' => 'xsd:string',
212
 array(
213
  0 => array(
214
   'firstname' => 'xsd:string',
215
   'lastname' => 'xsd:string',
216
   'status' => 'xsd:int',
217
   'loginname' => 'xsd:string',
218
   'password' => 'xsd:string',
219
   'encrypt_method' => 'xsd:string',
220
   'user_id_field_name' => 'xsd:string',
221
   'user_id_value' => 'xsd:string',
222
   'visibility' => 'xsd:int',
223
   'email' => 'xsd:string',
224
   'language' => 'xsd:string',
225
   'phone' => 'xsd:string',
226
   'expiration_date' => 'xsd:string',
227
   'extras' => 'tns:extra_field[]'
228
  ),
229
  1 => array(
230
   'firstname' => 'xsd:string',
231
   'lastname' => 'xsd:string',
232
   'status' => 'xsd:int',
233
   'loginname' => 'xsd:string',
234
   'password' => 'xsd:string',
235
   'encrypt_method' => 'xsd:string',
236
   'user_id_field_name' => 'xsd:string',
237
   'user_id_value' => 'xsd:string',
238
   'visibility' => 'xsd:int',
239
   'email' => 'xsd:string',
240
   'language' => 'xsd:string',
241
   'phone' => 'xsd:string',
242
   'expiration_date' => 'xsd:string',
243
   'extras' => 'tns:extra_field[]'
244
  )
245
 )
246
);
247 1 Yannick Warnier
</pre>
248
249 9 Yannick Warnier
h4. Output
250
251 1 Yannick Warnier
<pre>
252 9 Yannick Warnier
array(
253
 0 => array(
254
  'result' => 'xxx',
255
  'user_id_value' => 1504,
256
  'user_id_generated' => 1
257
 ),
258
 1 => array(
259
  'result' => 'xxx',
260
  'user_id_value' => 1504,
261
  'user_id_generated' => 1
262
 ),
263
);
264 6 Yannick Warnier
</pre>
265
266
h3. WSUser.EditUser
267
268 7 Yannick Warnier
Edits one user
269 1 Yannick Warnier
270 9 Yannick Warnier
h4. Input
271
272 7 Yannick Warnier
<pre>
273 1 Yannick Warnier
</pre>
274
275 9 Yannick Warnier
h4. Output
276
277 6 Yannick Warnier
<pre>
278 1 Yannick Warnier
</pre>
279 6 Yannick Warnier
280
h3. WSUser.EditUsers
281
282 1 Yannick Warnier
Edits several users in one call.
283
284 9 Yannick Warnier
h4. Input
285
286 1 Yannick Warnier
<pre>
287
</pre>
288 6 Yannick Warnier
289 9 Yannick Warnier
h4. Output
290
291 1 Yannick Warnier
<pre>
292 6 Yannick Warnier
</pre>
293
294 9 Yannick Warnier
295 1 Yannick Warnier
h3. WSCourse.DeleteCourse
296
297 6 Yannick Warnier
Deletes one course
298 7 Yannick Warnier
299 9 Yannick Warnier
h4. Input
300
301 6 Yannick Warnier
<pre>
302 7 Yannick Warnier
</pre>
303 6 Yannick Warnier
304 9 Yannick Warnier
h4. Output
305
306 6 Yannick Warnier
<pre>
307
</pre>
308 1 Yannick Warnier
309 9 Yannick Warnier
310 6 Yannick Warnier
h3. WSCourse.DeleteCourses
311
312 1 Yannick Warnier
Deletes several courses in one call.
313
314 9 Yannick Warnier
h4. Input
315
316 7 Yannick Warnier
<pre>
317 1 Yannick Warnier
</pre>
318 6 Yannick Warnier
319 9 Yannick Warnier
h4. Output
320
321 1 Yannick Warnier
<pre>
322
</pre>
323 6 Yannick Warnier
324 9 Yannick Warnier
325 1 Yannick Warnier
h3. WSCourse.CreateCourse
326
327 6 Yannick Warnier
Creates one course
328 7 Yannick Warnier
329 9 Yannick Warnier
h4. Input
330
331 7 Yannick Warnier
<pre>
332 6 Yannick Warnier
</pre>
333
334 9 Yannick Warnier
h4. Output
335
336 6 Yannick Warnier
<pre>
337
</pre>
338 1 Yannick Warnier
339 9 Yannick Warnier
340 6 Yannick Warnier
h3. WSCourse.CreateCourses
341
342
Creates several courses in one call.
343 1 Yannick Warnier
344 9 Yannick Warnier
h4. Input
345
346 7 Yannick Warnier
<pre>
347 1 Yannick Warnier
</pre>
348
349 9 Yannick Warnier
h4. Output
350
351 1 Yannick Warnier
<pre>
352
</pre>
353 6 Yannick Warnier
354 9 Yannick Warnier
355 6 Yannick Warnier
h3. WSCourse.EditCourse
356 1 Yannick Warnier
357 6 Yannick Warnier
Edits one course
358
359 9 Yannick Warnier
h4. Input
360
361 1 Yannick Warnier
<pre>
362 6 Yannick Warnier
</pre>
363
364 9 Yannick Warnier
h4. Output
365
366 6 Yannick Warnier
<pre>
367 7 Yannick Warnier
</pre>
368 6 Yannick Warnier
369 9 Yannick Warnier
370 7 Yannick Warnier
h3. WSCourse.ListCourses
371 6 Yannick Warnier
372
Lists courses
373 1 Yannick Warnier
374 9 Yannick Warnier
h4. Input
375
376 6 Yannick Warnier
<pre>
377 1 Yannick Warnier
</pre>
378
379 9 Yannick Warnier
h4. Output
380
381 6 Yannick Warnier
<pre>
382 1 Yannick Warnier
</pre>
383 6 Yannick Warnier
384 9 Yannick Warnier
385 7 Yannick Warnier
h3. WSCourse.SubscribeUserToCourse
386 1 Yannick Warnier
387
Subscribes one user to one course
388 6 Yannick Warnier
389 9 Yannick Warnier
h4. Input
390
391 1 Yannick Warnier
<pre>
392 6 Yannick Warnier
</pre>
393
394 9 Yannick Warnier
h4. Output
395
396 6 Yannick Warnier
<pre>
397
</pre>
398
399 9 Yannick Warnier
400 1 Yannick Warnier
h3. WSCourse.UnsubscribeUserFromCourse
401 6 Yannick Warnier
402
Unsubscribes one user from one course.
403 1 Yannick Warnier
404 9 Yannick Warnier
h4. Input
405
406 7 Yannick Warnier
<pre>
407 6 Yannick Warnier
</pre>
408 1 Yannick Warnier
409 9 Yannick Warnier
h4. Output
410
411 6 Yannick Warnier
<pre>
412 1 Yannick Warnier
</pre>
413
414 9 Yannick Warnier
415 6 Yannick Warnier
h3. WSCourse.GetCourseDescriptions
416 1 Yannick Warnier
417
Gets the list of course descriptions.
418 6 Yannick Warnier
419 9 Yannick Warnier
h4. Input
420
421 1 Yannick Warnier
<pre>
422 6 Yannick Warnier
</pre>
423
424 9 Yannick Warnier
h4. Output
425
426 1 Yannick Warnier
<pre>
427 6 Yannick Warnier
</pre>
428 7 Yannick Warnier
429 9 Yannick Warnier
430 1 Yannick Warnier
h3. WSCourse.EditCourseDescription
431 6 Yannick Warnier
432
Edits one description of one course.
433
434 9 Yannick Warnier
h4. Input
435
436 6 Yannick Warnier
<pre>
437
</pre>
438 1 Yannick Warnier
439 9 Yannick Warnier
h4. Output
440
441 6 Yannick Warnier
<pre>
442 1 Yannick Warnier
</pre>
443
444 9 Yannick Warnier
445 7 Yannick Warnier
h3. WSSession.CreateSession
446 6 Yannick Warnier
447 1 Yannick Warnier
Creates one session.
448 7 Yannick Warnier
449 9 Yannick Warnier
h4. Input
450
451 1 Yannick Warnier
<pre>
452
</pre>
453 6 Yannick Warnier
454 9 Yannick Warnier
h4. Output
455
456 1 Yannick Warnier
<pre>
457 6 Yannick Warnier
</pre>
458
459 9 Yannick Warnier
460 1 Yannick Warnier
h3. WSSession.DeleteSession
461 6 Yannick Warnier
462
Deletes one session.
463 7 Yannick Warnier
464 9 Yannick Warnier
h4. Input
465
466 6 Yannick Warnier
<pre>
467 7 Yannick Warnier
</pre>
468 1 Yannick Warnier
469 9 Yannick Warnier
h4. Output
470
471 6 Yannick Warnier
<pre>
472
</pre>
473 1 Yannick Warnier
474 9 Yannick Warnier
475 6 Yannick Warnier
h3. WSSession.EditSession
476
477 1 Yannick Warnier
Edits one session.
478
479 9 Yannick Warnier
h4. Input
480
481 1 Yannick Warnier
<pre>
482
</pre>
483 6 Yannick Warnier
484 9 Yannick Warnier
h4. Output
485
486 1 Yannick Warnier
<pre>
487 7 Yannick Warnier
</pre>
488 6 Yannick Warnier
489 9 Yannick Warnier
490 1 Yannick Warnier
h3. WSSession.SubscribeUserToSession
491
492 6 Yannick Warnier
Subscribes one user to one session.
493
494 9 Yannick Warnier
h4. Input
495
496 6 Yannick Warnier
<pre>
497
</pre>
498
499 9 Yannick Warnier
h4. Output
500
501 7 Yannick Warnier
<pre>
502 6 Yannick Warnier
</pre>
503 7 Yannick Warnier
504 9 Yannick Warnier
505 6 Yannick Warnier
h3. WSSession.UnsubscribeUserFromSession
506
507
Unsubscribes one user from one session
508
509 9 Yannick Warnier
h4. Input
510
511 6 Yannick Warnier
<pre>
512
</pre>
513 7 Yannick Warnier
514 9 Yannick Warnier
h4. Output
515
516 6 Yannick Warnier
<pre>
517
</pre>
518
519 9 Yannick Warnier
520 6 Yannick Warnier
h3. WSSession.SubscribeCourseToSession
521
522
Subscribes one course to one session.
523
524 9 Yannick Warnier
h4. Input
525
526 6 Yannick Warnier
<pre>
527 7 Yannick Warnier
</pre>
528 6 Yannick Warnier
529 9 Yannick Warnier
h4. Output
530
531 6 Yannick Warnier
<pre>
532
</pre>
533
534 9 Yannick Warnier
535 6 Yannick Warnier
h3. WSSession.UnsubscribeCourseFromSession
536
537 7 Yannick Warnier
Unsubscribes one course from one session
538 6 Yannick Warnier
539 9 Yannick Warnier
h4. Input
540
541 6 Yannick Warnier
<pre>
542
</pre>
543
544 9 Yannick Warnier
h4. Output
545
546 6 Yannick Warnier
<pre>
547
</pre>
548
549
550 1 Yannick Warnier
551 5 Yannick Warnier
h2. Chamilo <= 1.8.7: registration.soap.php
552 1 Yannick Warnier
553
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).
554
555
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.
556
557
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.
558
559
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:
560 2 Yannick Warnier
<pre>$security_key = 'abcdef1234567890';
561 1 Yannick Warnier
$ip_address = '134.23.25.34';
562 2 Yannick Warnier
$secret_key = sha1($ip_address.$security_key);</pre>
563 1 Yannick Warnier
564 2 Yannick Warnier
The $secret_key variable must then be added to the Web Service call.
565
566 1 Yannick Warnier
Calling the SOAP web services scripts is generally done through a URL of this kind:
567 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
568
569
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
570
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).
571
572
h3. DokeosWSCreateUsers
573 3 Yannick Warnier
574 1 Yannick Warnier
This function adds users into dokeos/chamilo, the password param is not encrypted
575
Input params
576
Follow the new structure:
577 4 Yannick Warnier
<pre>$params = array(
578 1 Yannick Warnier
         'users' =>array(          // array of users params, you can create many users
579
passing arrays of params
580
                array('firstname' => 'Christian',           //required
581
                       'lastname' => 'XXX',                 //required
582
                       'status' => '5', //required, (1 => teacher, 5 => learner)
583
                       'email' => 'XXX@gmail.dom',
584
                              //optional, follow the same format (example@domain.com)
585
                       'loginname' => 'usuario1',           //required
586
                       'password' => '12345',               //required
587
                       'language' => 'spanish',             //optional
588
                       'phone' => '12345678',               //optional
589
                      'expiration_date' => '0000-00-00 00:00:00',
590
                            //optional, follow the same format
591
                      'original_user_id_name' => 'USER',
592
                            //required, field name about original user id
593
                      'original_user_id_value' => '1',
594
                            //required, field value about original user id
595
                      'extra' => array (
596
                            //optional, extra fields about user's extras data,
597
                            //you can insert several extra fields
598
                            array('field_name' => 'direccion',
599
                                   'field_value' => 'Arquimedes 260'),
600
                                   // field name with your field value
601
                            array('field_name' => 'DNI',
602
                                   'field_value' => '416766220')
603
                                   // field name with your field value
604
                      )
605
              )
606
       ),
607
       'secret_key' => sha1('123')
608
       //required, secret key ("your IP address and security key from dokeos")
609
       // encrypted with sha1
610 4 Yannick Warnier
);</pre>
611 1 Yannick Warnier
Output params
612
The results are shown like follow structure:
613 4 Yannick Warnier
<pre>       array (
614 1 Yannick Warnier
          0 =>
615
            array (
616
               'original_user_id_value' => string '1',            // original user id that
617
you sent like param
618
               'result' => string '8'                    // new user id from dokeos,
619
return 0 if user in not inserted with sucess
620
              )
621 4 Yannick Warnier
       )</pre>
622 2 Yannick Warnier
623
h3. DokeosWSCreateUsersPasswordCrypted
624
625 1 Yannick Warnier
This function adds users into dokeos, the password param (your password with a salt) is
626
encrypted. It's very important sent the salt into an extra field param with field_name 'salt',
627
otherwise the user will be able login in
628
Input params
629
Follow the new structure:
630 4 Yannick Warnier
<pre>$params = array(
631 1 Yannick Warnier
       'users' =>array(
632
              // array of users params, you can create many users passing
633
              // arrays of params
634
              array(
635
                      'firstname' => 'Christian',                // required
636
                      'lastname' => 'XXX',                       // required
637
                     'status' => '5',
638
                            // required, (1 => teacher, 5 => learner)
639
                     'email' => 'XXX@gmail.dom',
640
                            // optional, follow the same format (example@domain.com)
641
                     'loginname' => 'usuarioA',             // required
642
                     'password' => md5('--christian--12345--'),
643
                            // required, it's important to define the salt into
644
                            // an extra field param
645
                     'encrypt_method' => 'md5',
646
                            // required, check if the encrypt is the same
647
                            // as dokeos configuration
648
                     'language' => 'spanish',               // optional
649
                     'phone' => '12345678',                 // optional
650
                     'expiration_date' => '0000-00-00 00:00:00',
651
                            // optional, follow the same format
652
                     'original_user_id_name' => 'USER',
653
                            //required, field name about original user id
654
                     'original_user_id_value' => '10',
655
                            //required, field value about original user id
656
                     'extra' => array (
657
                            //required, you must define at least field name 'salt'
658
                            // with the same value than your encryption
659
                            array('field_name' => 'salt',
660
                                  'field_value' => 'christian'),
661
                            array('field_name' => 'DNI',
662
                                  'field_value' => '123456')
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 '10'
675
                     // original user id that you sent like param
676
               'result' => string '8'
677
                     // new user id from dokeos, 0 if your operation is failed
678
                     // or a msg about your encrypt method
679 4 Yannick Warnier
</pre>
680 2 Yannick Warnier
681
h3. DokeosWSEditUsers
682
683 1 Yannick Warnier
This function edits users into dokeos, the password param is not encrypted
684
Input params
685
Follow the new structure:
686 4 Yannick Warnier
<pre>$params = array(
687 1 Yannick Warnier
       'users' =>array(
688
              // array of users params, you can edit many users passing
689
              // arrays of params
690
              array(
691
                     'original_user_id_value' => '1',
692
                            //required, field value about original user id
693
                     'original_user_id_name' => 'USER',
694
                            //required, field name about original user id
695
                     'firstname' => 'Christian',               //required
696
                     'lastname' => 'XXX',                      //required
697
                     'username' => 'usuario1',                 //required
698
                     'password' => '12345',                    //required
699
                     'email' => 'XXX@gmail.dom',
700
                            //optional, follow the same format (example@domain.com)
701
                     'status' => '5',
702
                            //optional, (1 => teacher, 5 => learner)
703
                     'phone' => '12345678',                    //optional
704
                     'expiration_date' => '0000-00-00 00:00:00',
705
                            //optional, follow the same format
706
                     'extra' => array (
707
                            //optional, extra fields about user's extras data,
708
                            // you can insert several extra fields
709
                            array('field_name' => 'direccion',
710
                                   'field_value' => 'Arquimedes 260'),
711
                                   // field name with your field value
712
                            array('field_name' => 'DNI',
713
                                   'field_value' => '416766220')
714
                                   // field name with your field value
715
                     )
716
             )
717
       ),
718
       'secret_key' => sha1('123')
719
              //required, secret key ("your IP address and security key
720
              // from dokeos") encrypted with sha1
721 4 Yannick Warnier
);</pre>
722 1 Yannick Warnier
Output params
723
The results are shown like follow structure:
724 4 Yannick Warnier
<pre>       array
725 1 Yannick Warnier
          0 =>
726
            array
727
               'original_user_id_value' => string '1'
728
                     // original user id that you sent like param
729
               'result' => string '1'
730
                     // '1' if your operation is Ok, '0' otherwise
731 4 Yannick Warnier
</pre>
732 2 Yannick Warnier
733
h3. DokeosWSEditUsersPasswordCrypted
734
735 1 Yannick Warnier
This function edits users into dokeos, if you edit password it must be encrypted with sha1
736
(password with a salt), and don't forget define the salt into extra field with field name 'salt',
737
otherwise the user will be able log in.
738
Input params
739
Follow the new structure:
740 4 Yannick Warnier
<pre>$params = array(
741 1 Yannick Warnier
       'users' =>array( // array of users params, you can edit many users
742
passing arrays of params
743
               array(
744
                      'original_user_id_value' => '10',
745
                              //required, field value about original user id
746
                      'original_user_id_name' => 'USER',
747
                              //required, field name about original user id
748
                      'firstname' => 'Christian',             // required
749
                      'lastname' => 'XXX',                    // required
750
                      'username' => 'usuarioA',               // required
751
                      'password' => md5('--christian--12345--'),
752
                              // required, it's important to define the salt into
753
                              // an extra field param
754
                      'encrypt_method' => 'md5',
755
                              // required, check if the encrypt is the same than
756
                              // dokeos configuration
757
                      'email' => 'XXX@gmail.dom',
758
                              // optional, follow the same format (example@domain.com)
759
                      'status' => '5', // required, (1 => teacher, 5 => learner)
760
                      'phone' => '12345678', // optional
761
                      'expiration_date' => '0000-00-00 00:00:00',
762
                              // optional, follow the same format
763
                      'extra' => array (
764
                              //required, you must define at least field name 'salt'
765
                              // with the same value than your encryption
766
                      array('field_name' => 'salt',
767
                              'field_value' => 'christian'),
768
                      array('field_name' => 'DNI',
769
                              'field_value' => '123456')
770
              )
771
       ),
772
       'secret_key' => sha1('123') //required, secret key ("your IP address and
773
security key from dokeos") encrypted with sha1
774 4 Yannick Warnier
);</pre>
775 1 Yannick Warnier
Output params
776
The results are shown like follow structure:
777 4 Yannick Warnier
<pre>array
778 1 Yannick Warnier
   0 =>
779
     array
780
        'original_user_id_value' => string '10'
781
               // original user id that you sent like param
782
        'result' => string '8'
783
               // new user id from dokeos, 0 if your operation is failed
784
               // or a msg about your encrypt method
785 4 Yannick Warnier
</pre>
786 2 Yannick Warnier
787
h3. DokeosWSDeleteUsers
788
789 1 Yannick Warnier
This function only disable users into dokeos, if you want delete from database you can
790
delete it from user list into your dokeos portal
791
Input params
792
Follow the new structure:
793 4 Yannick Warnier
<pre>$params = array(
794 1 Yannick Warnier
       'users' =>array(
795
              // array of users params, you can delete many users passing
796
              // arrays of params
797
              array(
798
                    'original_user_id_name' => 'USER',
799
                           //required, field name about original user id
800
                    'original_user_id_value' => '1',
801
                           //required, field value about original user id
802
             )
803
       ),
804
       'secret_key' => sha1('123') //required, secret key ("your IP address and
805
security key from dokeos") encrypted with sha1
806 4 Yannick Warnier
);</pre>
807 1 Yannick Warnier
Output params
808
The results are shown like follow structure:
809 4 Yannick Warnier
<pre>array
810 1 Yannick Warnier
   0 =>
811
     array
812
        'original_user_id_value' => string '1'
813
              // original user id that you sent like param
814
        'result' => string '1'
815
              // '1' if your operation is Ok, '0' otherwise
816 4 Yannick Warnier
</pre>
817 2 Yannick Warnier
818 4 Yannick Warnier
h3. DokeosWSCreateCourse
819 2 Yannick Warnier
820 1 Yannick Warnier
This function creates courses into dokeos
821
Input params
822
Follow the new structure:
823 4 Yannick Warnier
<pre>$params = array(
824 1 Yannick Warnier
       'courses' =>array(
825
              // array of courses params, this depend your memory limit,
826
              // it is recommended not passing 3 courses
827
              array(
828
                    'title' => 'Religion',         // required
829
                    'category_code' => 'LANG',     // required (LANG,PROJ)
830
                    'wanted_code' => '',
831
                           // optional, if it's not defined dokeos will
832
                           // generate it
833
                    'tutor_name' => 'Christian Fasanando', // optional
834
                    'course_language' => 'spanish',            // optional
835
                    'original_course_id_name' => 'CURSO',
836
                           //required, field name about original course id
837
                    'original_course_id_value' => '1',
838
                           //required, field value about original course id
839
                    'extra' => array (
840
                           array('field_name' => 'edicion',
841
                                  'field_value' => 'Arquimedes 260'),
842
                           array('field_name' => 'libros',
843
                                  'field_value' =>'XXX')
844
                    )
845
             )
846
       ),
847
       'secret_key' => sha1('123')
848
              //required, secret key ("your IP address
849
              //and security key from dokeos") encrypted with sha1
850 4 Yannick Warnier
);</pre>
851 1 Yannick Warnier
Output params
852
The results are shown like follow structure:
853 4 Yannick Warnier
<pre>array
854 1 Yannick Warnier
   0 =>
855
     array
856
        'original_course_id_value' => string '1'
857
              // original course id that you sent like param
858
        'result' => string 'RELIGION'
859
       // new course code from dokeos, '0' if the operation has been failed
860 4 Yannick Warnier
</pre>
861 2 Yannick Warnier
862 4 Yannick Warnier
h3. DokeosWSCreateCourseByTitle
863 1 Yannick Warnier
864
This function creates courses into dokeos by title
865
Input params
866
Follow the new structure:
867 4 Yannick Warnier
<pre>$params = array(
868 1 Yannick Warnier
       'courses' =>array(
869
              // array of courses params, this depend your memory limit,
870
              //it's recommended not passing 3 courses
871
              array(
872
                     'title' => 'Religion',         // required
873
                     'tutor_name' => 'Christian Fasanando', // optional
874
                     'original_course_id_name' => 'CURSO',
875
                           //required, field name about original course id
876
                     'original_course_id_value' => '1',
877
                           //required, field value about original course id
878
                     'extra' => array (
879
                           array('field_name' => 'edicion',
880
                                  'field_value' => Arquimedes 260'),
881
                           array('field_name' => 'libros',
882
                                  'field_value' =>'XXX')
883
                     )
884
             )
885
       ),
886
       'secret_key' => sha1('123')
887
              //required, secret key ("your IP address and security key
888
              // from dokeos") encrypted with sha1
889 4 Yannick Warnier
);</pre>
890
891 1 Yannick Warnier
Output params
892
The results are shown like follow structure:
893 4 Yannick Warnier
<pre>array
894 1 Yannick Warnier
   0 =>
895
     array
896
        'original_course_id_value' => string '1'
897
              // original course id that you sent like param
898
        'result' => string 'RELIGION'
899
              // new course code from dokeos, '0' if the operation has been failed
900 4 Yannick Warnier
</pre>
901 2 Yannick Warnier
902
h3. DokeosWSEditCourse
903
904 1 Yannick Warnier
This function edits courses into dokeos
905
Input params
906
Follow the new structure:
907 4 Yannick Warnier
<pre>$params = array(
908 1 Yannick Warnier
       'courses' =>array(
909
              // array of courses params, this depend your memory limit,
910
              // it's recommended not passing 3 courses
911
              array(
912
                    'tutor_id' => '1',              // required
913
                    'title' => 'Religion',          // required
914
                    'category_code' => 'LANG',      // required
915
                    'department_name' => '',        // optional
916
                    'department_url' => '',         // optional
917
                    'course_language' => 'english',       // optional
918
                    'visibility' => '3',
919
                           // optional ('0' = closed,'1' = private access,
920
                           // '2' = access allowed for users registered on
921
                           // the platform, '3' = access allowed for
922
                           // the whole world )
923
                    'subscribe' => '1', // optional ('0' = denied, '1' = allowed)
924
                    'unsubscribe' => '0', //optional ('0' = denied, '1' = allowed)
925
                    'visual_code' => '',
926
                           // optional, if it's not defined
927
                           // dokeos will be generate it
928
                    'original_course_id_name' => 'CURSO',
929
                           //required, field name about original course id
930
                    'original_course_id_value' => '1',
931
                           //required, field value about original course id
932
                    'extra' => array (        //optional
933
                           array('field_name' => 'edicion',
934
                                  'field_value' => 'Arquimedes 260'),
935
                           array('field_name' => 'libros',
936
                                  'field_value' =>'XXX')
937
                    )
938
             )
939
       ),
940
       'secret_key' => sha1('123') //required, secret key ("your IP address and
941
security key from dokeos") encrypted with sha1
942 4 Yannick Warnier
);</pre>
943 1 Yannick Warnier
Output params
944
The results are shown like follow structure:
945 4 Yannick Warnier
<pre>array
946 1 Yannick Warnier
   0 =>
947
     array
948
        'original_course_id_value' => string '1'
949
              // original course id that you sent like param
950
        'result' => string '1'
951
              // '1' if the operation is OK, '0' otherwise
952 4 Yannick Warnier
</pre>
953 1 Yannick Warnier
954 2 Yannick Warnier
h3. DokeosWSDeleteCourse
955
956 1 Yannick Warnier
This function set visibility to '0', this not allow a user to access it, if you want remove from
957
database you must delete from courses list into your dokeos portal
958
Input params
959
Follow the new structure:
960 4 Yannick Warnier
<pre>$params = array(
961 1 Yannick Warnier
       'courses' =>array(
962
              // array of courses params, this depend your memory limit,
963
              // it's recommended not passing 3 courses
964
              array(
965
                     'original_course_id_value' => '1',
966
                              //required, field value about original course id
967
                     'original_course_id_name' => 'CURSO',
968
                              //required, field name about original course id
969
             )
970
       ),
971
       'secret_key' => sha1('123')
972
              //required, secret key ("your IP address and security key
973
              // from dokeos") encrypted with sha1
974 4 Yannick Warnier
);</pre>
975 1 Yannick Warnier
Output params
976
The results are shown like follow structure:
977 4 Yannick Warnier
<pre>array
978 1 Yannick Warnier
   0 =>
979
     array
980
        'original_course_id_value' => string '1'
981
              // original course id that you sent like param
982
        'result' => string '1'
983
              // '1' if the operation is OK, '0' otherwise
984 4 Yannick Warnier
</pre>
985 2 Yannick Warnier
986 1 Yannick Warnier
h3. DokeosWSCreateSession
987
988
This function creates sessions into dokeos
989
Input params
990
Follow the new structure:
991 4 Yannick Warnier
<pre>$params = array(
992 1 Yannick Warnier
       'sessions' =>array(                    // array of session params, you can create
993
many session
994
              array(
995
                     'name' => 'SESION3',             //required
996
                     'year_start' => '2000', // required if nolimit param is '1'
997
                     'month_start' => '11', // required if nolimit param is '1'
998
                     'day_start' => '10', // required if nolimit param is '1'
999
                     'year_end' => '2001', //required if nolimit param is '1'
1000
                     'month_end' => '12',      //required if nolimit param is '1'
1001
                     'day_end' => '11',        //required if nolimit param is '1'
1002
                     'nb_days_acess_before' => '0',
1003
                     // optional, define access delays of the coach (days before)
1004
                     'nb_days_acess_after' => '0',
1005
                     // optional, define access delays of the coach (days after)
1006
                     'nolimit' => '0',
1007
                            // required, 0 = no limit time, 1 = limit time
1008
                     'user_id' => '3', // required, a user id from dokeos
1009
                     'original_session_id_name' => 'SESION',
1010
                            //required, field name about original session id
1011
                     'original_session_id_value' =>'3',
1012
                            //required, field value about original session id
1013
                     'extra' => array ( // optional
1014
                            array('field_name' => 'edicion',
1015
                                   'field_value' => 'Arquimedes 260'),
1016
                            array('field_name' => 'libros',
1017
                                   'field_value' =>'XXX')
1018
                     )
1019
             )
1020
       ),
1021
       'secret_key' => sha1('123')
1022
              //required, secret key ("your IP address and security key from
1023
              // dokeos") encrypted with sha1
1024 4 Yannick Warnier
);</pre>
1025 1 Yannick Warnier
Output params
1026
The results are shown like follow structure:
1027 4 Yannick Warnier
<pre>array
1028 1 Yannick Warnier
   0 =>
1029
     array
1030
        'original_session_id_value' => string '3'
1031
              // original session id that you sent like param
1032
        'result' => string '11'
1033 2 Yannick Warnier
              // new session id from dokeos, '0' if the operation has been failed
1034 4 Yannick Warnier
</pre>
1035 2 Yannick Warnier
1036 1 Yannick Warnier
h3. DokeosWSEditSession
1037
1038
This function edits a session into dokeos
1039
Input params
1040
Follow the new structure:
1041 4 Yannick Warnier
<pre>$params = array(
1042 1 Yannick Warnier
       'sessions' =>array( // array of session params, you can edit many session
1043
              array(
1044
                     'name' => 'SESION3',      //required
1045
                     'year_start' => '2000', // required if nolimit param is '1'
1046
                     'month_start' => '11', // required if nolimit param is '1'
1047
                     'day_start' => '10',     // required if nolimit param is '1'
1048
                    'year_end' => '2001',     //required if nolimit param is '1'
1049
                    'month_end' => '12',      //required if nolimit param is '1'
1050
                    'day_end' => '11',        //required if nolimit param is '1'
1051
                    'nb_days_acess_before' => '0',
1052
                    // optional, define access delays of the coach (days before)
1053
                    'nb_days_acess_after' => '0',
1054
                    // optional, define access delays of the coach (days after)
1055
                    'nolimit' => '0',
1056
                           // required, 0 = no limit time, 1 = limit time
1057
                    'user_id' => '3', // required, a user id from dokeos
1058
                    'original_session_id_name' => 'SESION',
1059
                           //required, field name about original session id
1060
                    'original_session_id_value' =>'3',
1061
                           //required, field value about original session id
1062
                    'extra' => array ( // optional
1063
                           array('field_name' => 'edicion',
1064
                                  'field_value' => 'Arquimedes 260'),
1065
                           array('field_name' => 'libros', 'field_value' =>'XXX')
1066
                    )
1067
             )
1068
       ),
1069
       'secret_key' => sha1('123')
1070
              //required, secret key ("your IP address and security key
1071
              //from dokeos") encrypted with sha1
1072 4 Yannick Warnier
);</pre>
1073 1 Yannick Warnier
Output params
1074
The results are shown like follow structure:
1075 4 Yannick Warnier
<pre>array
1076 1 Yannick Warnier
   0 =>
1077
     array
1078
        'original_session_id_value' => string '3'
1079
              // original session id that you sent like param
1080
        'result' => string '1'
1081
              // '1' if the operation is OK, '0' otherwise
1082 4 Yannick Warnier
</pre>
1083 1 Yannick Warnier
1084 2 Yannick Warnier
h3. DokeosWSDeleteSession
1085
1086 1 Yannick Warnier
This function deletes a session from database into dokeos
1087
Input params
1088
Follow the new structure:
1089 4 Yannick Warnier
<pre>$params = array(
1090 1 Yannick Warnier
       'sessions' =>array(
1091
              // array of session params, you can delete many session
1092
              array(
1093
                    'original_session_id_value' =>'3',
1094
                           //required, field value about original session id
1095
                    'original_session_id_name' => 'SESION',
1096
                           //required, field name about original session id
1097
             )
1098
       ),
1099
       'secret_key' => sha1('123')
1100
              //required, secret key ("your IP address and security key
1101
              //from dokeos") encrypted with sha1
1102 4 Yannick Warnier
);</pre>
1103 1 Yannick Warnier
Output params
1104
The results are shown like follow structure:
1105 4 Yannick Warnier
<pre>array
1106 1 Yannick Warnier
   0 =>
1107
     array
1108
        'original_session_id_value' => string '3'
1109
              // original session id that you sent like param
1110
        'result' => string '1'
1111
              // '1' if the operation is OK, '0' otherwise
1112 4 Yannick Warnier
</pre>
1113 2 Yannick Warnier
1114 4 Yannick Warnier
h3. DokeosWSSubscribeUserToCourse
1115 1 Yannick Warnier
1116 2 Yannick Warnier
This function suscribe many users to a course into dokeos
1117 1 Yannick Warnier
Input params
1118
Follow the new structure:
1119 4 Yannick Warnier
<pre>$params = array(
1120 1 Yannick Warnier
       'userscourses' =>array(
1121
              // array of userscourses params, you can suscribe many users
1122
              //into many courses
1123
              array(
1124
                     'original_user_id_values' => array('1','2'),
1125
                     // required, array of field value about original user id
1126
                     'original_user_id_name' => 'USER',
1127
                           //required, field name about original user id
1128
                     'original_course_id_value' => '1',
1129
                           //required, field value about original course id
1130
                     'original_course_id_name' => 'CURSO',
1131
                           //required, field name about original course id
1132
              )
1133
       ),
1134
       'secret_key' => sha1('123')
1135
              //required, secret key ("your IP address and security key
1136
              // from dokeos") encrypted with sha1
1137 4 Yannick Warnier
);</pre>
1138 1 Yannick Warnier
Output params
1139
The results are shown like follow structure:
1140 4 Yannick Warnier
<pre>$output[] = array(
1141 1 Yannick Warnier
       'original_user_id_value' =>$orig_user_id_value[$i],
1142
       'original_course_id_value' =>$orig_course_id_value[$i],
1143
       'result' => $results[$i]);
1144
array
1145
   0 =>
1146
     array
1147
        'original_user_id_value' => string '1,2'
1148
              // original users id that you sent like param
1149
        'original_course_id_value' => string '1'
1150
              // original course id that you sent like param
1151
        'result' => string '1'
1152
              // '1' if the operation is OK, '0' otherwise
1153 4 Yannick Warnier
</pre>
1154 2 Yannick Warnier
1155
h3. DokeosWSUnSubscribeUserFromCourse
1156 1 Yannick Warnier
1157
This function unsuscribe many users from courses into dokeos
1158
Input params
1159
Follow the new structure:
1160 4 Yannick Warnier
<pre>$params = array(
1161 1 Yannick Warnier
       'userscourses' =>array(               // array of userscourses params, you can
1162
unsuscribe many users from many courses
1163
              array(
1164
                    'original_user_id_values' => array('1','2'),
1165
                           // required, array of field value about original user id
1166
                    'original_user_id_name' => 'USER',
1167
                           //required, field name about original user id
1168
                    'original_course_id_value' => '1',
1169
                           //required, field value about original course id
1170
                    'original_course_id_name' => 'CURSO',
1171
                           //required, field name about original course id
1172
             )
1173
       ),
1174
       'secret_key' => sha1('123') //required, secret key ("your IP address and
1175
security key from dokeos") encrypted with sha1
1176 4 Yannick Warnier
);</pre>
1177 1 Yannick Warnier
Output params
1178
The results are shown like follow structure:
1179 4 Yannick Warnier
<pre>array
1180 1 Yannick Warnier
   0 =>
1181
     array
1182
        'original_user_id_value' => string '1,2'
1183
              // original users id that you sent like param
1184
       'original_course_id_value' => string '1'
1185
              // original course id that you sent like param
1186
       'result' => string '1'
1187
              // '1' if the operation is OK, '0' otherwise
1188 4 Yannick Warnier
</pre>
1189 2 Yannick Warnier
1190
h3. DokeosWSSuscribeUsersToSession
1191 1 Yannick Warnier
1192
This function suscribe many users to sessions into dokeos
1193
Input params
1194
Follow the new structure:
1195 4 Yannick Warnier
<pre>$params = array(
1196 1 Yannick Warnier
       'userssessions' =>array(
1197
              // array of userssessions params, you can suscribe many users
1198
              //into many sessions
1199
              array(
1200
                     'original_user_id_values' => array('1','2'),
1201
                           // required, array of field value about original user id
1202
                     'original_user_id_name' => 'USER',
1203
                           //required, field name about original user id
1204
                     'original_session_id_value' => '1',
1205
                           //required, field value about original session id
1206
                     'original_session_id_name' => 'SESION',
1207
                           //required, field name about original session id
1208
             )
1209
       ),
1210
       'secret_key' => sha1('123')
1211
              //required, secret key ("your IP address and security key
1212
              // from dokeos") encrypted with sha1
1213 4 Yannick Warnier
);</pre>
1214 1 Yannick Warnier
Output params
1215
The results are shown like follow structure:
1216 4 Yannick Warnier
<pre>array
1217 1 Yannick Warnier
   0 =>
1218
     array
1219
        'original_user_id_value' => string '1,2'
1220
              // original users id that you sent like param
1221
       'original_session_id_value' => string '1'
1222
              // original session id that you sent like param
1223
       'result' => string '1'
1224
              // '1' if the operation is OK, '0' otherwise
1225 4 Yannick Warnier
</pre>
1226 2 Yannick Warnier
1227
h3. DokeosWSUnsuscribeUsersFromSession
1228 1 Yannick Warnier
1229
This function unsuscribe many users from sessions into dokeos
1230
Input params
1231
Follow the new structure:
1232 4 Yannick Warnier
<pre>$params = array(
1233 1 Yannick Warnier
       'userssessions' =>array(
1234
              // array of userssessions params, you can unsuscribe many users
1235
              // from many sessions
1236
              array(
1237
                     'original_user_id_values' => array('1','2'),
1238
                           // required, array of field value about original user id
1239
                     'original_user_id_name' => 'USER',
1240
                           //required, field name about original user id
1241
                     'original_session_id_value' => '1',
1242
                           //required, field value about original session id
1243
                     'original_session_id_name' => 'SESION',
1244
                           //required, field name about original session id
1245
             )
1246
       ),
1247
       'secret_key' => sha1('123')
1248
              //required, secret key ("your IP address and security key
1249
              // from dokeos") encrypted with sha1
1250 4 Yannick Warnier
);</pre>
1251 1 Yannick Warnier
Output params
1252
The results are shown like follow structure:
1253 4 Yannick Warnier
<pre>array
1254 1 Yannick Warnier
   0 =>
1255
     array
1256
        'original_user_id_values' => string '1,2'
1257
              // original users id that you sent like param
1258
        'original_session_id_value' => string '1'
1259
              // original session id that you sent like param
1260
        'result' => string '1'
1261
              // '1' if the operation is OK, '0' otherwise
1262 4 Yannick Warnier
</pre>
1263 2 Yannick Warnier
1264
h3. DokeosWSSuscribeCoursesToSession
1265 1 Yannick Warnier
1266
This function suscribe many courses to sessions into dokeos
1267
Input params
1268
Follow the new structure:
1269 4 Yannick Warnier
<pre>$params = array(
1270 1 Yannick Warnier
       'coursessessions' =>array(
1271
              // array of coursessessions params, you can suscribe many
1272
              // courses from many sessions
1273
              array(
1274
                     'original_course_id_values' => array('1','2'),
1275
                     // required, array of field values about original course id
1276
                     'original_course_id_name' => 'CURSO',
1277
                     //required, field name about original course id
1278
                     'original_session_id_value' => '1',
1279
                     //required, field value about original session id
1280
                     'original_session_id_name' => 'SESION',
1281
                     //required, field name about original session id
1282
             )
1283
       ),
1284
       'secret_key' => sha1('123')
1285
              //required, secret key ("your IP address
1286
              // and security key from dokeos") encrypted with sha1
1287 4 Yannick Warnier
);</pre>
1288 1 Yannick Warnier
Output params
1289
The results are shown like follow structure:
1290 4 Yannick Warnier
<pre>array
1291 1 Yannick Warnier
   0 =>
1292
     array
1293
        'original_course_id_values' => string '1,2'
1294
              // original courses id that you sent like param
1295
       'original_session_id_value' => string '1'
1296
              // original session id that you sent like param
1297
       'result' => string 'RELIGION,MATE'
1298
              // deparment urls of courses suscribed, '0' otherwise
1299 4 Yannick Warnier
</pre>
1300 1 Yannick Warnier
1301
h3. DokeosWSUnsuscribeCoursesFromSession
1302 2 Yannick Warnier
1303
This function unsuscribe many courses from sessions into dokeos
1304
Input params
1305 1 Yannick Warnier
Follow the new structure:
1306 4 Yannick Warnier
<pre>$params = array(
1307 1 Yannick Warnier
       'coursessessions' =>array(
1308
                    // array of coursessessions params, you can unsuscribe
1309
                    //many courses from many sessions
1310
              array(
1311
                    'original_course_id_values' => array('1','2'),
1312
                    // required, array of field values about original course id
1313
                    'original_course_id_name' => 'CURSO',
1314
                    //required, field name about original course id
1315
                    'original_session_id_value' => '1',
1316
                    //required, field value about original session id
1317
                    'original_session_id_name' => 'SESION',
1318
                    //required, field name about original session id
1319
             )
1320
       ),
1321
       'secret_key' => sha1('123')
1322
              //required, secret key ("your IP address and security key
1323
              // from dokeos") encrypted with sha1
1324 4 Yannick Warnier
);</pre>
1325 1 Yannick Warnier
Output params
1326
The results are shown like follow structure:
1327 4 Yannick Warnier
<pre>array
1328 1 Yannick Warnier
   0 =>
1329
     array
1330
       'original_course_id_values' => string       '1,2'
1331
              // original courses id that you      sent like param
1332
       'original_session_id_value' => string       '1'
1333
              // original session id that you      sent like param
1334
       'result' => string '1'
1335
              // '1' if the operation is OK,       '0' otherwise
1336 4 Yannick Warnier
</pre>
1337 1 Yannick Warnier
1338
h3. DokeosWSCourseDescription
1339
1340
This function return categories list from course description, if the value is a string '' it
1341 2 Yannick Warnier
means there are not title and content by category. Actually exits only 8 categories what you
1342
can modify title and content, see course description tool in your portal dokeos
1343
Input params
1344 1 Yannick Warnier
Follow the new structure:
1345 4 Yannick Warnier
<pre>$params = array(
1346 1 Yannick Warnier
       'original_course_id_name' => 'CURSO',
1347
              // required, field name about original course id
1348
       'original_course_id_value' => '2',
1349
              // required, field value about original course id
1350
       'secret_key' => sha1('123')
1351
              // required, secret key ("your IP address and security key
1352
              // from dokeos") encrypted with sha1
1353 4 Yannick Warnier
 );</pre>
1354 1 Yannick Warnier
Results
1355
Return categories list about course description
1356
1357
h3. DokeosWSEditCourseDescription
1358
1359
This function modify title and content about categories from course description
1360 2 Yannick Warnier
Input params
1361
Follow the new structure:
1362 4 Yannick Warnier
<pre>
1363 1 Yannick Warnier
$params = array(
1364
       'course_desc' =>array(
1365
              // array course description params, you can create modify
1366
              // many titles and contents
1367
              array(
1368
                     'course_desc_id' => '1',
1369
                            //required, category id from course description (1-8),
1370
                            // see results of DokeosWSCourseDescription function
1371
                            //for more information
1372
                     'course_desc_title' => 'Descripcion',
1373
                            //required, title about a category you want modify
1374
                     'course_desc_content' => 'descripcion mod',
1375
                            //required, content about a category you want modify
1376
                     'original_course_id_name' => 'CURSO',
1377
                            //required, field name about original course id
1378
                      'original_course_id_value' => '2'
1379
                             //required, field value about original course id
1380
             )
1381
        ),
1382
        'secret_key' => sha1('123')
1383
              //required, secret key ("your IP address and security key
1384
              //from dokeos") encrypted with sha1
1385
);
1386 4 Yannick Warnier
</pre>
1387 1 Yannick Warnier
Output params
1388
The results are shown like follow structure:
1389 4 Yannick Warnier
<pre>
1390 1 Yannick Warnier
array
1391
   0 =>
1392
     array
1393
        'original_course_id_value' => string '10'
1394
              // original course id that you sent like param
1395
        'result' => string '1'
1396
              // '1' if operation is OK, 0 otherwise
1397 4 Yannick Warnier
</pre>
1398 1 Yannick Warnier
NOTE: In all functions above if your secret key param is incorrect they'll return an empty array
1399 2 Yannick Warnier
1400 4 Yannick Warnier
h3. DokeosWSCreateUserPasswordCrypted
1401 2 Yannick Warnier
1402
This function adds only a user into dokeos, the password param (your password with a
1403 1 Yannick Warnier
salt) is encrypted. It's very important sent the salt into an extra field param with
1404
field_name 'salt', otherwise the user will be able login in .
1405
Input params
1406
Follow the new structure:
1407 4 Yannick Warnier
<pre>
1408 1 Yannick Warnier
$params =
1409
        array(
1410
              'firstname' => 'Christian',                 // required
1411
              'lastname' => 'XXX',                        // required
1412
              'status' => '5',
1413
                      // required, (1 => teacher, 5 => learner)
1414
              'email' => 'XXX@gmail.dom',
1415
                      // optional, follow the same format (example@domain.com)
1416
              'loginname' => 'usuarioIV',                 // required
1417
              'password' => md5('--christian--12345--'),
1418
                      // required, it's important to define the salt
1419
                      // into an extra field param
1420
              'encrypt_method' => 'md5',          // required, check if the encrypt
1421
                      // is the same than dokeos configuration
1422
              'language' => 'spanish',                    // optional
1423
              'phone' => '12345678',                      // optional
1424
              'expiration_date' => '0000-00-00 00:00:00',
1425
                      // optional, follow the same format
1426
              'original_user_id_name' => 'USER',
1427
                      //required, field name about original user id
1428
              'original_user_id_value' => 'A5',
1429
                      //required, field value about original user id
1430
               'extra' => array (
1431
                      //required, you must define at least field name 'salt'
1432
                      // with the same value than your encryption
1433
                      array(
1434
                             'field_name' => 'salt',
1435
                             'field_value' => 'christian'),
1436
                      array(
1437
                             'field_name' => 'DNI',
1438
                             'field_value' => '123456')
1439
         ),
1440
         'secret_key' => sha1('123')
1441
               //required, secret key ("your IP address and security key
1442
               // from dokeos") encrypted with sha1
1443 4 Yannick Warnier
         );</pre>
1444 1 Yannick Warnier
Output params
1445
A string about result:
1446 4 Yannick Warnier
<pre>-1 - Secret key is incorrect
1447 1 Yannick Warnier
        new user id from dokeos - If the operation is OK
1448
0 - If the operation has failed
1449 4 Yannick Warnier
</pre>
1450 2 Yannick Warnier
1451
h3. DokeosWSEditUserPasswordCrypted
1452
1453 1 Yannick Warnier
This function edits only a user into dokeos, if you edit password it must be encrypted with
1454
sha1 (password with a salt), and don't forget define the salt into extra field with field name
1455
'salt', otherwise the user will be able log in.
1456
Input params
1457
Follow the new structure:
1458 4 Yannick Warnier
<pre>$params =
1459 1 Yannick Warnier
         array(
1460
               'original_user_id_value' => '10',
1461
                      //required, field value about original user id
1462
               'original_user_id_name' => 'USER',
1463
                      //required, field name about original user id
1464
               'firstname' => 'Christian',               // required
1465
               'lastname' => 'XXX',                      // required
1466
               'username' => 'usuarioA',                 // required
1467
               'password' => md5('--christian--12345--'),
1468
                      // required, it's important to define the salt into
1469
                      // an extra field param
1470
               'encrypt_method' => 'md5',
1471
               // required, check if the encrypt is the same
1472
               // than dokeos configuration
1473
               'email' => 'XXX@gmail.dom',
1474
               // optional, follow the same format (example@domain.com)
1475
               'status' => '5', // required, (1 => teacher, 5 => learner)
1476
               'phone' => '12345678', // optional
1477
               'expiration_date' => '0000-00-00 00:00:00',
1478
                      // optional, follow the same format
1479
               'extra' => array (
1480
                      //required, you must define at least field name 'salt'
1481
                     // with the same value than your encryption
1482
                     array('field_name' => 'salt',
1483
                           'field_value' => 'christian'),
1484
                     array('field_name' => 'DNI',
1485
                           'field_value' => '123456')
1486
              ),
1487
              'secret_key' => sha1('123')
1488
                     // required, secret key ("your IP address and security
1489
                     // key from dokeos") encrypted with sha1
1490
);
1491 4 Yannick Warnier
</pre>
1492 1 Yannick Warnier
Output params
1493
A string about result:
1494 4 Yannick Warnier
<pre>-1 - Secret key is incorrect
1495 1 Yannick Warnier
 1 - If the operation is OK
1496
 0 - If the operation has failed
1497 4 Yannick Warnier
</pre>
1498 1 Yannick Warnier
1499 4 Yannick Warnier
h3. DokeosWSCreateUser
1500 2 Yannick Warnier
1501
This function adds only a user into dokeos, the password param is not encrypted
1502 1 Yannick Warnier
Input params
1503
Follow the new structure:
1504 4 Yannick Warnier
<pre>$params =
1505 1 Yannick Warnier
       array(
1506
              'firstname' => 'Christian',            //required
1507
              'lastname' => 'XXX',                   //required
1508
              'status' => '5',
1509
                     //required, (1 => teacher, 5 => learner)
1510
              'email' => 'XXX@gmail.dom',
1511
                     //optional, follow the same format (example@domain.com)
1512
              'loginname' => 'usuario1',             //required
1513
              'password' => '12345',                 //required
1514
              'language' => 'spanish',               //optional
1515
              'phone' => '12345678',                 //optional
1516
              'expiration_date' => '0000-00-00 00:00:00',
1517
                     //optional, follow the same format
1518
              'original_user_id_name' => 'USER',
1519
                     //required, field name about original user id
1520
              'original_user_id_value' => '1',
1521
                     //required, field value about original user id
1522
              'extra' => array (
1523
                     //optional, extra fields about user's extras data,
1524
                     //you can insert several extra fields
1525
                     array('field_name' => 'direccion',
1526
                           'field_value' => 'Arquimedes 260'),
1527
                           // field name with your field value
1528
                     array('field_name' => 'DNI',
1529
                           'field_value' => '416766220')
1530
                           // field name with your field value
1531
              ),
1532
       'secret_key' => sha1('123')
1533
              //required, secret key ("your IP address and security key
1534
              // from dokeos") encrypted with sha1
1535
     );
1536 4 Yannick Warnier
</pre>
1537 1 Yannick Warnier
Output params
1538
A string about result:
1539 4 Yannick Warnier
<pre>          -1 - Secret key is incorrect
1540 1 Yannick Warnier
            new user id from dokeos - If the operation is OK
1541
          0 - If the operation has failed
1542 4 Yannick Warnier
</pre>
1543 1 Yannick Warnier
1544 4 Yannick Warnier
h3. DokeosWSEditUser
1545 1 Yannick Warnier
1546
This function edits only a user into dokeos, the password param is not encrypted
1547
Input params
1548
Follow the new structure:
1549 4 Yannick Warnier
<pre>
1550 2 Yannick Warnier
$params =
1551
       array(
1552
              'original_user_id_value' => '1',
1553 1 Yannick Warnier
                     //required, field value about original user id
1554
              'original_user_id_name' => 'USER',
1555
                     //required, field name about original user id
1556
              'firstname' => 'Christian',             //required
1557
              'lastname' => 'XXX',                    //required
1558
              'username' => 'usuario1',               //required
1559
              'password' => '12345',                  //required
1560
              'email' => 'XXX@gmail.dom',
1561
                     //optional, follow the same format (example@domain.com)
1562
              'status' => '5',
1563
                     //optional, (1 => teacher, 5 => learner)
1564
              'phone' => '12345678',                  //optional
1565
              'expiration_date' => '0000-00-00 00:00:00',
1566
                     //optional, follow the same format
1567
              'extra' => array (
1568
                     //optional, extra fields about user's extras data,
1569
                     // you can insert several extra fields
1570
                     array('field_name' => 'direccion',
1571
                            'field_value' => 'Arquimedes 260'),
1572
                            // field name with your field value
1573
                     array('field_name' => 'DNI',
1574
                            'field_value' => '416766220')
1575
                            // field name with your field value
1576
              ),
1577
              'secret_key' => sha1('123')
1578
                     //required, secret key ("your IP address and security key
1579
                     // from dokeos") encrypted with sha1
1580
           );
1581 4 Yannick Warnier
</pre>
1582 1 Yannick Warnier
Output params
1583
A string about result:
1584 4 Yannick Warnier
<pre>
1585 1 Yannick Warnier
          -1 - Secret key is incorrect
1586
            1 - If the operation is OK
1587
          0 - If the operation has failed
1588 4 Yannick Warnier
</pre>
1589
h3. DokeosWSDeleteUser
1590 1 Yannick Warnier
1591
This function only disable only a user into dokeos, if you want delete from database you
1592 2 Yannick Warnier
can delete it from user list into your dokeos portal
1593
Input params
1594
Follow the new structure:
1595 4 Yannick Warnier
<pre>
1596 1 Yannick Warnier
$params =
1597
       array(
1598
               'original_user_id_name' => 'USER',
1599
                     //required, field name about original user id
1600
               'original_user_id_value' => '1',
1601
                     //required, field value about original user id
1602
               'secret_key' => sha1('123')
1603
                     //required, secret key ("your IP address and security key
1604
                     // from dokeos") encrypted with sha1
1605
             );
1606 4 Yannick Warnier
</pre>
1607 1 Yannick Warnier
Output params
1608
A string about result:
1609 4 Yannick Warnier
<pre>
1610 1 Yannick Warnier
          -1 - Secret key is incorrect
1611
            1 - If the operation is OK
1612
          0 - If the operation has failed
1613 4 Yannick Warnier
</pre>