Project

General

Profile

Web services » History » Version 11

Yannick Warnier, 14/10/2011 22:20

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 11 Yannick Warnier
h2. Chamilo > 1.8.8.4
13
14
Please check the introduction to Chamilo > 1.8.7 first
15
16
h3. WSUser.EditUserCredentials
17
18
Edits the username and/or (unencrypted) password
19
20
h4. Input
21
22
<pre>
23
array(
24
 'secret_key' => 'abcdef1234567890',
25
 'user_id_field_name' => 'external_user',
26
 'user_id_value' => '1504',
27
 'username' => 'slee',
28
 'password' => 'abcdef'
29
);
30
</pre>
31
32
h4. Output
33
34
<pre>
35
1 (or -1 on failure)
36
</pre>
37
38
39 10 Yannick Warnier
h2. Chamilo > 1.8.7
40
41 6 Yannick Warnier
42
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.
43
44
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:
45
<pre>$security_key = 'abcdef1234567890';
46
$ip_address = '134.23.25.34';
47
$secret_key = sha1($ip_address.$security_key);</pre>
48
49
The $secret_key variable must then be added to the Web Service call.
50
51
Calling the SOAP web services scripts is generally done through a URL of this kind:
52
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
53
54
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
55
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).
56
57 8 Yannick Warnier
h3. External identifiers
58
59
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*.
60
61
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.
62
63 6 Yannick Warnier
h3. WSUser.DisableUser
64
65
Disables one user
66 1 Yannick Warnier
67 8 Yannick Warnier
h4. Input
68
69 1 Yannick Warnier
<pre>
70 8 Yannick Warnier
array(
71
 'secret_key' => 'abcdef1234567890',
72
 'user_id_field_name' => 'external_user',
73
 'user_id_value' => '1504',
74
);
75 1 Yannick Warnier
</pre>
76
77 8 Yannick Warnier
h4. Output
78
79 6 Yannick Warnier
<pre>
80 8 Yannick Warnier
nothing (or error message)
81 6 Yannick Warnier
</pre>
82
83
h3. WSUser.DisableUsers
84 1 Yannick Warnier
85
Disables several users in one call.
86 6 Yannick Warnier
87 8 Yannick Warnier
h4. Input
88
89 1 Yannick Warnier
<pre>
90 8 Yannick Warnier
array(
91
'secret_key' => 'abcdef1234567890',
92
 array( 
93
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
94
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
95
 )
96
);
97 6 Yannick Warnier
</pre>
98 1 Yannick Warnier
99 8 Yannick Warnier
h4. Output
100
101 1 Yannick Warnier
<pre>
102 8 Yannick Warnier
array(
103
  0=>array('code'=>0,'message'=>'Operation was successful'),
104
  1=>array('code'=>0,'message'=>'Operation was successful'),
105
);
106 6 Yannick Warnier
</pre>
107
108
h3. WSUser.EnableUser
109
110 7 Yannick Warnier
Enables one user
111 6 Yannick Warnier
112 9 Yannick Warnier
h4. Input
113
114 1 Yannick Warnier
<pre>
115 9 Yannick Warnier
array(
116
 'secret_key' => 'abcdef1234567890',
117
 'user_id_field_name' => 'external_user',
118
 'user_id_value' => '1504',
119
);
120 1 Yannick Warnier
</pre>
121
122 9 Yannick Warnier
h4. Output
123
124 6 Yannick Warnier
<pre>
125 9 Yannick Warnier
nothing (or error message)
126 7 Yannick Warnier
</pre>
127 6 Yannick Warnier
128 7 Yannick Warnier
h3. WSUser.EnableUsers
129 1 Yannick Warnier
130
Enables several users in one call.
131 6 Yannick Warnier
132 9 Yannick Warnier
h4. Input
133
134 1 Yannick Warnier
<pre>
135 9 Yannick Warnier
array(
136
'secret_key' => 'abcdef1234567890',
137
 array( 
138
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
139
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
140
 )
141
);
142 6 Yannick Warnier
</pre>
143 1 Yannick Warnier
144 9 Yannick Warnier
h4. Output
145
146 1 Yannick Warnier
<pre>
147 9 Yannick Warnier
array(
148
  0=>array('code'=>0,'message'=>'Operation was successful'),
149
  1=>array('code'=>0,'message'=>'Operation was successful'),
150
);
151 7 Yannick Warnier
</pre>
152 1 Yannick Warnier
153
h3. WSUser.DeleteUser
154 6 Yannick Warnier
155 1 Yannick Warnier
Deletes one user
156
157 9 Yannick Warnier
h4. Input
158
159 1 Yannick Warnier
<pre>
160 9 Yannick Warnier
array(
161
 'secret_key' => 'abcdef1234567890',
162
 'user_id_field_name' => 'external_user',
163
 'user_id_value' => '1504',
164
);
165 6 Yannick Warnier
</pre>
166
167 9 Yannick Warnier
h4. Output
168
169 7 Yannick Warnier
<pre>
170 9 Yannick Warnier
nothing (or error message)
171 1 Yannick Warnier
</pre>
172 6 Yannick Warnier
173 1 Yannick Warnier
h3. WSUser.DeleteUsers
174
175
Deletes several users in one call
176
177 9 Yannick Warnier
h4. Input
178
179 1 Yannick Warnier
<pre>
180 9 Yannick Warnier
array(
181
'secret_key' => 'abcdef1234567890',
182
 array( 
183
  0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
184
  1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
185
 )
186
);
187 1 Yannick Warnier
</pre>
188 6 Yannick Warnier
189 9 Yannick Warnier
h4. Output
190
191 6 Yannick Warnier
<pre>
192 9 Yannick Warnier
array(
193
  0=>array('code'=>0,'message'=>'Operation was successful'),
194
  1=>array('code'=>0,'message'=>'Operation was successful'),
195
);
196 1 Yannick Warnier
</pre>
197
198
h3. WSUser.CreateUser
199
200
Creates one user
201
202 9 Yannick Warnier
h4. Input
203
204 1 Yannick Warnier
<pre>
205 9 Yannick Warnier
array(
206
'secret_key' => 'xsd:string',
207
'firstname' => 'xsd:string',
208
'lastname' => 'xsd:string',
209
'status' => 'xsd:int',
210
'loginname' => 'xsd:string',
211
'password' => 'xsd:string',
212
'encrypt_method' => 'xsd:string',
213
'user_id_field_name' => 'xsd:string',
214
'user_id_value' => 'xsd:string',
215
'visibility' => 'xsd:int',
216
'email' => 'xsd:string',
217
'language' => 'xsd:string',
218
'phone' => 'xsd:string',
219
'expiration_date' => 'xsd:string',
220
'extras' => 'tns:extra_field[]'
221
);
222 6 Yannick Warnier
</pre>
223 1 Yannick Warnier
224 9 Yannick Warnier
h4. Output
225
226 1 Yannick Warnier
<pre>
227 9 Yannick Warnier
int new_user_id
228 1 Yannick Warnier
</pre>
229
230
h3. WSUser.CreateUsers
231
232
Creates several users in one call.
233
234 9 Yannick Warnier
h4. Input
235
236 1 Yannick Warnier
<pre>
237 9 Yannick Warnier
array(
238
 'secret_key' => 'xsd:string',
239
 array(
240
  0 => array(
241
   'firstname' => 'xsd:string',
242
   'lastname' => 'xsd:string',
243
   'status' => 'xsd:int',
244
   'loginname' => 'xsd:string',
245
   'password' => 'xsd:string',
246
   'encrypt_method' => 'xsd:string',
247
   'user_id_field_name' => 'xsd:string',
248
   'user_id_value' => 'xsd:string',
249
   'visibility' => 'xsd:int',
250
   'email' => 'xsd:string',
251
   'language' => 'xsd:string',
252
   'phone' => 'xsd:string',
253
   'expiration_date' => 'xsd:string',
254
   'extras' => 'tns:extra_field[]'
255
  ),
256
  1 => array(
257
   'firstname' => 'xsd:string',
258
   'lastname' => 'xsd:string',
259
   'status' => 'xsd:int',
260
   'loginname' => 'xsd:string',
261
   'password' => 'xsd:string',
262
   'encrypt_method' => 'xsd:string',
263
   'user_id_field_name' => 'xsd:string',
264
   'user_id_value' => 'xsd:string',
265
   'visibility' => 'xsd:int',
266
   'email' => 'xsd:string',
267
   'language' => 'xsd:string',
268
   'phone' => 'xsd:string',
269
   'expiration_date' => 'xsd:string',
270
   'extras' => 'tns:extra_field[]'
271
  )
272
 )
273
);
274 1 Yannick Warnier
</pre>
275
276 9 Yannick Warnier
h4. Output
277
278 1 Yannick Warnier
<pre>
279 9 Yannick Warnier
array(
280
 0 => array(
281
  'result' => 'xxx',
282
  'user_id_value' => 1504,
283
  'user_id_generated' => 1
284
 ),
285
 1 => array(
286
  'result' => 'xxx',
287
  'user_id_value' => 1504,
288
  'user_id_generated' => 1
289
 ),
290
);
291 6 Yannick Warnier
</pre>
292
293
h3. WSUser.EditUser
294
295 7 Yannick Warnier
Edits one user
296 1 Yannick Warnier
297 9 Yannick Warnier
h4. Input
298
299 7 Yannick Warnier
<pre>
300 1 Yannick Warnier
</pre>
301
302 9 Yannick Warnier
h4. Output
303
304 6 Yannick Warnier
<pre>
305 1 Yannick Warnier
</pre>
306 6 Yannick Warnier
307
h3. WSUser.EditUsers
308
309 1 Yannick Warnier
Edits several users in one call.
310
311 9 Yannick Warnier
h4. Input
312
313 1 Yannick Warnier
<pre>
314
</pre>
315 6 Yannick Warnier
316 9 Yannick Warnier
h4. Output
317
318 1 Yannick Warnier
<pre>
319 6 Yannick Warnier
</pre>
320
321 9 Yannick Warnier
322 1 Yannick Warnier
h3. WSCourse.DeleteCourse
323
324 6 Yannick Warnier
Deletes one course
325 7 Yannick Warnier
326 9 Yannick Warnier
h4. Input
327
328 6 Yannick Warnier
<pre>
329 7 Yannick Warnier
</pre>
330 6 Yannick Warnier
331 9 Yannick Warnier
h4. Output
332
333 6 Yannick Warnier
<pre>
334
</pre>
335 1 Yannick Warnier
336 9 Yannick Warnier
337 6 Yannick Warnier
h3. WSCourse.DeleteCourses
338
339 1 Yannick Warnier
Deletes several courses in one call.
340
341 9 Yannick Warnier
h4. Input
342
343 7 Yannick Warnier
<pre>
344 1 Yannick Warnier
</pre>
345 6 Yannick Warnier
346 9 Yannick Warnier
h4. Output
347
348 1 Yannick Warnier
<pre>
349
</pre>
350 6 Yannick Warnier
351 9 Yannick Warnier
352 1 Yannick Warnier
h3. WSCourse.CreateCourse
353
354 6 Yannick Warnier
Creates one course
355 7 Yannick Warnier
356 9 Yannick Warnier
h4. Input
357
358 7 Yannick Warnier
<pre>
359 6 Yannick Warnier
</pre>
360
361 9 Yannick Warnier
h4. Output
362
363 6 Yannick Warnier
<pre>
364
</pre>
365 1 Yannick Warnier
366 9 Yannick Warnier
367 6 Yannick Warnier
h3. WSCourse.CreateCourses
368
369
Creates several courses in one call.
370 1 Yannick Warnier
371 9 Yannick Warnier
h4. Input
372
373 7 Yannick Warnier
<pre>
374 1 Yannick Warnier
</pre>
375
376 9 Yannick Warnier
h4. Output
377
378 1 Yannick Warnier
<pre>
379
</pre>
380 6 Yannick Warnier
381 9 Yannick Warnier
382 6 Yannick Warnier
h3. WSCourse.EditCourse
383 1 Yannick Warnier
384 6 Yannick Warnier
Edits one course
385
386 9 Yannick Warnier
h4. Input
387
388 1 Yannick Warnier
<pre>
389 6 Yannick Warnier
</pre>
390
391 9 Yannick Warnier
h4. Output
392
393 6 Yannick Warnier
<pre>
394 7 Yannick Warnier
</pre>
395 6 Yannick Warnier
396 9 Yannick Warnier
397 7 Yannick Warnier
h3. WSCourse.ListCourses
398 6 Yannick Warnier
399
Lists courses
400 1 Yannick Warnier
401 9 Yannick Warnier
h4. Input
402
403 6 Yannick Warnier
<pre>
404 1 Yannick Warnier
</pre>
405
406 9 Yannick Warnier
h4. Output
407
408 6 Yannick Warnier
<pre>
409 1 Yannick Warnier
</pre>
410 6 Yannick Warnier
411 9 Yannick Warnier
412 7 Yannick Warnier
h3. WSCourse.SubscribeUserToCourse
413 1 Yannick Warnier
414
Subscribes one user to one course
415 6 Yannick Warnier
416 9 Yannick Warnier
h4. Input
417
418 1 Yannick Warnier
<pre>
419 6 Yannick Warnier
</pre>
420
421 9 Yannick Warnier
h4. Output
422
423 6 Yannick Warnier
<pre>
424
</pre>
425
426 9 Yannick Warnier
427 1 Yannick Warnier
h3. WSCourse.UnsubscribeUserFromCourse
428 6 Yannick Warnier
429
Unsubscribes one user from one course.
430 1 Yannick Warnier
431 9 Yannick Warnier
h4. Input
432
433 7 Yannick Warnier
<pre>
434 6 Yannick Warnier
</pre>
435 1 Yannick Warnier
436 9 Yannick Warnier
h4. Output
437
438 6 Yannick Warnier
<pre>
439 1 Yannick Warnier
</pre>
440
441 9 Yannick Warnier
442 6 Yannick Warnier
h3. WSCourse.GetCourseDescriptions
443 1 Yannick Warnier
444
Gets the list of course descriptions.
445 6 Yannick Warnier
446 9 Yannick Warnier
h4. Input
447
448 1 Yannick Warnier
<pre>
449 6 Yannick Warnier
</pre>
450
451 9 Yannick Warnier
h4. Output
452
453 1 Yannick Warnier
<pre>
454 6 Yannick Warnier
</pre>
455 7 Yannick Warnier
456 9 Yannick Warnier
457 1 Yannick Warnier
h3. WSCourse.EditCourseDescription
458 6 Yannick Warnier
459
Edits one description of one course.
460
461 9 Yannick Warnier
h4. Input
462
463 6 Yannick Warnier
<pre>
464
</pre>
465 1 Yannick Warnier
466 9 Yannick Warnier
h4. Output
467
468 6 Yannick Warnier
<pre>
469 1 Yannick Warnier
</pre>
470
471 9 Yannick Warnier
472 7 Yannick Warnier
h3. WSSession.CreateSession
473 6 Yannick Warnier
474 1 Yannick Warnier
Creates one session.
475 7 Yannick Warnier
476 9 Yannick Warnier
h4. Input
477
478 1 Yannick Warnier
<pre>
479
</pre>
480 6 Yannick Warnier
481 9 Yannick Warnier
h4. Output
482
483 1 Yannick Warnier
<pre>
484 6 Yannick Warnier
</pre>
485
486 9 Yannick Warnier
487 1 Yannick Warnier
h3. WSSession.DeleteSession
488 6 Yannick Warnier
489
Deletes one session.
490 7 Yannick Warnier
491 9 Yannick Warnier
h4. Input
492
493 6 Yannick Warnier
<pre>
494 7 Yannick Warnier
</pre>
495 1 Yannick Warnier
496 9 Yannick Warnier
h4. Output
497
498 6 Yannick Warnier
<pre>
499
</pre>
500 1 Yannick Warnier
501 9 Yannick Warnier
502 6 Yannick Warnier
h3. WSSession.EditSession
503
504 1 Yannick Warnier
Edits one session.
505
506 9 Yannick Warnier
h4. Input
507
508 1 Yannick Warnier
<pre>
509
</pre>
510 6 Yannick Warnier
511 9 Yannick Warnier
h4. Output
512
513 1 Yannick Warnier
<pre>
514 7 Yannick Warnier
</pre>
515 6 Yannick Warnier
516 9 Yannick Warnier
517 1 Yannick Warnier
h3. WSSession.SubscribeUserToSession
518
519 6 Yannick Warnier
Subscribes one user to one session.
520
521 9 Yannick Warnier
h4. Input
522
523 6 Yannick Warnier
<pre>
524
</pre>
525
526 9 Yannick Warnier
h4. Output
527
528 7 Yannick Warnier
<pre>
529 6 Yannick Warnier
</pre>
530 7 Yannick Warnier
531 9 Yannick Warnier
532 6 Yannick Warnier
h3. WSSession.UnsubscribeUserFromSession
533
534
Unsubscribes one user from one session
535
536 9 Yannick Warnier
h4. Input
537
538 6 Yannick Warnier
<pre>
539
</pre>
540 7 Yannick Warnier
541 9 Yannick Warnier
h4. Output
542
543 6 Yannick Warnier
<pre>
544
</pre>
545
546 9 Yannick Warnier
547 6 Yannick Warnier
h3. WSSession.SubscribeCourseToSession
548
549
Subscribes one course to one session.
550
551 9 Yannick Warnier
h4. Input
552
553 1 Yannick Warnier
<pre>
554
</pre>
555 4 Yannick Warnier
556
h4. Output
557 1 Yannick Warnier
558
<pre>
559 2 Yannick Warnier
</pre>
560
561
562 4 Yannick Warnier
h3. WSSession.UnsubscribeCourseFromSession
563 1 Yannick Warnier
564
Unsubscribes one course from one session
565
566
h4. Input
567
568
<pre>
569
</pre>
570
571
h4. Output
572
573 4 Yannick Warnier
<pre>
574 1 Yannick Warnier
</pre>
575
576 4 Yannick Warnier
577 1 Yannick Warnier
578
h2. Chamilo <= 1.8.7: registration.soap.php
579
580 11 Yannick Warnier
The following documentation gives a complete description of the behaviour of the Chamilo Web Services. These