Project

General

Profile

Web services » History » Version 8

Yannick Warnier, 30/06/2010 03:45

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