Project

General

Profile

Actions

Web services » History » Revision 5

« Previous | Revision 5/12 (diff) | Next »
Yannick Warnier, 30/06/2010 02:50


Web services

Chamilo <= 1.8.7: registration.soap.php

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).

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.

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.

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:

$security_key = 'abcdef1234567890';
$ip_address = '134.23.25.34';
$secret_key = sha1($ip_address.$security_key);

The $secret_key variable must then be added to the Web Service call.

Calling the SOAP web services scripts is generally done through a URL of this kind:
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

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
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).

DokeosWSCreateUsers

This function adds users into dokeos/chamilo, the password param is not encrypted
Input params
Follow the new structure:

$params = array(
         'users' =>array(          // array of users params, you can create many users
passing arrays of params
                array('firstname' => 'Christian',           //required
                       'lastname' => 'XXX',                 //required
                       'status' => '5', //required, (1 => teacher, 5 => learner)
                       'email' => 'XXX@gmail.dom',
                              //optional, follow the same format (example@domain.com)
                       'loginname' => 'usuario1',           //required
                       'password' => '12345',               //required
                       'language' => 'spanish',             //optional
                       'phone' => '12345678',               //optional
                      'expiration_date' => '0000-00-00 00:00:00',
                            //optional, follow the same format
                      'original_user_id_name' => 'USER',
                            //required, field name about original user id
                      'original_user_id_value' => '1',
                            //required, field value about original user id
                      'extra' => array (
                            //optional, extra fields about user's extras data,
                            //you can insert several extra fields
                            array('field_name' => 'direccion',
                                   'field_value' => 'Arquimedes 260'),
                                   // field name with your field value
                            array('field_name' => 'DNI',
                                   'field_value' => '416766220')
                                   // field name with your field value
                      )
              )
       ),
       'secret_key' => sha1('123')
       //required, secret key ("your IP address and security key from dokeos")
       // encrypted with sha1
);

Output params
The results are shown like follow structure:
       array (
          0 =>
            array (
               'original_user_id_value' => string '1',            // original user id that
you sent like param
               'result' => string '8'                    // new user id from dokeos,
return 0 if user in not inserted with sucess
              )
       )

DokeosWSCreateUsersPasswordCrypted

This function adds users into dokeos, the password param (your password with a salt) is
encrypted. It's very important sent the salt into an extra field param with field_name 'salt',
otherwise the user will be able login in
Input params
Follow the new structure:

$params = array(
       'users' =>array(
              // array of users params, you can create many users passing
              // arrays of params
              array(
                      'firstname' => 'Christian',                // required
                      'lastname' => 'XXX',                       // required
                     'status' => '5',
                            // required, (1 => teacher, 5 => learner)
                     'email' => 'XXX@gmail.dom',
                            // optional, follow the same format (example@domain.com)
                     'loginname' => 'usuarioA',             // required
                     'password' => md5('--christian--12345--'),
                            // required, it's important to define the salt into
                            // an extra field param
                     'encrypt_method' => 'md5',
                            // required, check if the encrypt is the same
                            // as dokeos configuration
                     'language' => 'spanish',               // optional
                     'phone' => '12345678',                 // optional
                     'expiration_date' => '0000-00-00 00:00:00',
                            // optional, follow the same format
                     'original_user_id_name' => 'USER',
                            //required, field name about original user id
                     'original_user_id_value' => '10',
                            //required, field value about original user id
                     'extra' => array (
                            //required, you must define at least field name 'salt'
                            // with the same value than your encryption
                            array('field_name' => 'salt',
                                  'field_value' => 'christian'),
                            array('field_name' => 'DNI',
                                  'field_value' => '123456')
                     )
              ),
              'secret_key' => sha1('123')
                     //required, secret key ("your IP address and security key
                     // from dokeos") encrypted with sha1
       );

Output params
The results are shown like follow structure:
       array
          0 =>
            array
               'original_user_id_value' => string '10'
                     // original user id that you sent like param
               'result' => string '8'
                     // new user id from dokeos, 0 if your operation is failed
                     // or a msg about your encrypt method

DokeosWSEditUsers

This function edits users into dokeos, the password param is not encrypted
Input params
Follow the new structure:

$params = array(
       'users' =>array(
              // array of users params, you can edit many users passing
              // arrays of params
              array(
                     'original_user_id_value' => '1',
                            //required, field value about original user id
                     'original_user_id_name' => 'USER',
                            //required, field name about original user id
                     'firstname' => 'Christian',               //required
                     'lastname' => 'XXX',                      //required
                     'username' => 'usuario1',                 //required
                     'password' => '12345',                    //required
                     'email' => 'XXX@gmail.dom',
                            //optional, follow the same format (example@domain.com)
                     'status' => '5',
                            //optional, (1 => teacher, 5 => learner)
                     'phone' => '12345678',                    //optional
                     'expiration_date' => '0000-00-00 00:00:00',
                            //optional, follow the same format
                     'extra' => array (
                            //optional, extra fields about user's extras data,
                            // you can insert several extra fields
                            array('field_name' => 'direccion',
                                   'field_value' => 'Arquimedes 260'),
                                   // field name with your field value
                            array('field_name' => 'DNI',
                                   'field_value' => '416766220')
                                   // field name with your field value
                     )
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
       array
          0 =>
            array
               'original_user_id_value' => string '1'
                     // original user id that you sent like param
               'result' => string '1'
                     // '1' if your operation is Ok, '0' otherwise

DokeosWSEditUsersPasswordCrypted

This function edits users into dokeos, if you edit password it must be encrypted with sha1
(password with a salt), and don't forget define the salt into extra field with field name 'salt',
otherwise the user will be able log in.
Input params
Follow the new structure:

$params = array(
       'users' =>array( // array of users params, you can edit many users
passing arrays of params
               array(
                      'original_user_id_value' => '10',
                              //required, field value about original user id
                      'original_user_id_name' => 'USER',
                              //required, field name about original user id
                      'firstname' => 'Christian',             // required
                      'lastname' => 'XXX',                    // required
                      'username' => 'usuarioA',               // required
                      'password' => md5('--christian--12345--'),
                              // required, it's important to define the salt into
                              // an extra field param
                      'encrypt_method' => 'md5',
                              // required, check if the encrypt is the same than
                              // dokeos configuration
                      'email' => 'XXX@gmail.dom',
                              // optional, follow the same format (example@domain.com)
                      'status' => '5', // required, (1 => teacher, 5 => learner)
                      'phone' => '12345678', // optional
                      'expiration_date' => '0000-00-00 00:00:00',
                              // optional, follow the same format
                      'extra' => array (
                              //required, you must define at least field name 'salt'
                              // with the same value than your encryption
                      array('field_name' => 'salt',
                              'field_value' => 'christian'),
                      array('field_name' => 'DNI',
                              'field_value' => '123456')
              )
       ),
       'secret_key' => sha1('123') //required, secret key ("your IP address and
security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_user_id_value' => string '10'
               // original user id that you sent like param
        'result' => string '8'
               // new user id from dokeos, 0 if your operation is failed
               // or a msg about your encrypt method

DokeosWSDeleteUsers

This function only disable users into dokeos, if you want delete from database you can
delete it from user list into your dokeos portal
Input params
Follow the new structure:

$params = array(
       'users' =>array(
              // array of users params, you can delete many users passing
              // arrays of params
              array(
                    'original_user_id_name' => 'USER',
                           //required, field name about original user id
                    'original_user_id_value' => '1',
                           //required, field value about original user id
             )
       ),
       'secret_key' => sha1('123') //required, secret key ("your IP address and
security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_user_id_value' => string '1'
              // original user id that you sent like param
        'result' => string '1'
              // '1' if your operation is Ok, '0' otherwise

DokeosWSCreateCourse

This function creates courses into dokeos
Input params
Follow the new structure:

$params = array(
       'courses' =>array(
              // array of courses params, this depend your memory limit,
              // it is recommended not passing 3 courses
              array(
                    'title' => 'Religion',         // required
                    'category_code' => 'LANG',     // required (LANG,PROJ)
                    'wanted_code' => '',
                           // optional, if it's not defined dokeos will
                           // generate it
                    'tutor_name' => 'Christian Fasanando', // optional
                    'course_language' => 'spanish',            // optional
                    'original_course_id_name' => 'CURSO',
                           //required, field name about original course id
                    'original_course_id_value' => '1',
                           //required, field value about original course id
                    'extra' => array (
                           array('field_name' => 'edicion',
                                  'field_value' => 'Arquimedes 260'),
                           array('field_name' => 'libros',
                                  'field_value' =>'XXX')
                    )
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address
              //and security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_course_id_value' => string '1'
              // original course id that you sent like param
        'result' => string 'RELIGION'
       // new course code from dokeos, '0' if the operation has been failed

DokeosWSCreateCourseByTitle

This function creates courses into dokeos by title
Input params
Follow the new structure:

$params = array(
       'courses' =>array(
              // array of courses params, this depend your memory limit,
              //it's recommended not passing 3 courses
              array(
                     'title' => 'Religion',         // required
                     'tutor_name' => 'Christian Fasanando', // optional
                     'original_course_id_name' => 'CURSO',
                           //required, field name about original course id
                     'original_course_id_value' => '1',
                           //required, field value about original course id
                     'extra' => array (
                           array('field_name' => 'edicion',
                                  'field_value' => Arquimedes 260'),
                           array('field_name' => 'libros',
                                  'field_value' =>'XXX')
                     )
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:

array
   0 =>
     array
        'original_course_id_value' => string '1'
              // original course id that you sent like param
        'result' => string 'RELIGION'
              // new course code from dokeos, '0' if the operation has been failed

DokeosWSEditCourse

This function edits courses into dokeos
Input params
Follow the new structure:

$params = array(
       'courses' =>array(
              // array of courses params, this depend your memory limit,
              // it's recommended not passing 3 courses
              array(
                    'tutor_id' => '1',              // required
                    'title' => 'Religion',          // required
                    'category_code' => 'LANG',      // required
                    'department_name' => '',        // optional
                    'department_url' => '',         // optional
                    'course_language' => 'english',       // optional
                    'visibility' => '3',
                           // optional ('0' = closed,'1' = private access,
                           // '2' = access allowed for users registered on
                           // the platform, '3' = access allowed for
                           // the whole world )
                    'subscribe' => '1', // optional ('0' = denied, '1' = allowed)
                    'unsubscribe' => '0', //optional ('0' = denied, '1' = allowed)
                    'visual_code' => '',
                           // optional, if it's not defined
                           // dokeos will be generate it
                    'original_course_id_name' => 'CURSO',
                           //required, field name about original course id
                    'original_course_id_value' => '1',
                           //required, field value about original course id
                    'extra' => array (        //optional
                           array('field_name' => 'edicion',
                                  'field_value' => 'Arquimedes 260'),
                           array('field_name' => 'libros',
                                  'field_value' =>'XXX')
                    )
             )
       ),
       'secret_key' => sha1('123') //required, secret key ("your IP address and
security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_course_id_value' => string '1'
              // original course id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSDeleteCourse

This function set visibility to '0', this not allow a user to access it, if you want remove from
database you must delete from courses list into your dokeos portal
Input params
Follow the new structure:

$params = array(
       'courses' =>array(
              // array of courses params, this depend your memory limit,
              // it's recommended not passing 3 courses
              array(
                     'original_course_id_value' => '1',
                              //required, field value about original course id
                     'original_course_id_name' => 'CURSO',
                              //required, field name about original course id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_course_id_value' => string '1'
              // original course id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSCreateSession

This function creates sessions into dokeos
Input params
Follow the new structure:

$params = array(
       'sessions' =>array(                    // array of session params, you can create
many session
              array(
                     'name' => 'SESION3',             //required
                     'year_start' => '2000', // required if nolimit param is '1'
                     'month_start' => '11', // required if nolimit param is '1'
                     'day_start' => '10', // required if nolimit param is '1'
                     'year_end' => '2001', //required if nolimit param is '1'
                     'month_end' => '12',      //required if nolimit param is '1'
                     'day_end' => '11',        //required if nolimit param is '1'
                     'nb_days_acess_before' => '0',
                     // optional, define access delays of the coach (days before)
                     'nb_days_acess_after' => '0',
                     // optional, define access delays of the coach (days after)
                     'nolimit' => '0',
                            // required, 0 = no limit time, 1 = limit time
                     'user_id' => '3', // required, a user id from dokeos
                     'original_session_id_name' => 'SESION',
                            //required, field name about original session id
                     'original_session_id_value' =>'3',
                            //required, field value about original session id
                     'extra' => array ( // optional
                            array('field_name' => 'edicion',
                                   'field_value' => 'Arquimedes 260'),
                            array('field_name' => 'libros',
                                   'field_value' =>'XXX')
                     )
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key from
              // dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_session_id_value' => string '3'
              // original session id that you sent like param
        'result' => string '11'
              // new session id from dokeos, '0' if the operation has been failed

DokeosWSEditSession

This function edits a session into dokeos
Input params
Follow the new structure:

$params = array(
       'sessions' =>array( // array of session params, you can edit many session
              array(
                     'name' => 'SESION3',      //required
                     'year_start' => '2000', // required if nolimit param is '1'
                     'month_start' => '11', // required if nolimit param is '1'
                     'day_start' => '10',     // required if nolimit param is '1'
                    'year_end' => '2001',     //required if nolimit param is '1'
                    'month_end' => '12',      //required if nolimit param is '1'
                    'day_end' => '11',        //required if nolimit param is '1'
                    'nb_days_acess_before' => '0',
                    // optional, define access delays of the coach (days before)
                    'nb_days_acess_after' => '0',
                    // optional, define access delays of the coach (days after)
                    'nolimit' => '0',
                           // required, 0 = no limit time, 1 = limit time
                    'user_id' => '3', // required, a user id from dokeos
                    'original_session_id_name' => 'SESION',
                           //required, field name about original session id
                    'original_session_id_value' =>'3',
                           //required, field value about original session id
                    'extra' => array ( // optional
                           array('field_name' => 'edicion',
                                  'field_value' => 'Arquimedes 260'),
                           array('field_name' => 'libros', 'field_value' =>'XXX')
                    )
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              //from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_session_id_value' => string '3'
              // original session id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSDeleteSession

This function deletes a session from database into dokeos
Input params
Follow the new structure:

$params = array(
       'sessions' =>array(
              // array of session params, you can delete many session
              array(
                    'original_session_id_value' =>'3',
                           //required, field value about original session id
                    'original_session_id_name' => 'SESION',
                           //required, field name about original session id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              //from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_session_id_value' => string '3'
              // original session id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSSubscribeUserToCourse

This function suscribe many users to a course into dokeos
Input params
Follow the new structure:

$params = array(
       'userscourses' =>array(
              // array of userscourses params, you can suscribe many users
              //into many courses
              array(
                     'original_user_id_values' => array('1','2'),
                     // required, array of field value about original user id
                     'original_user_id_name' => 'USER',
                           //required, field name about original user id
                     'original_course_id_value' => '1',
                           //required, field value about original course id
                     'original_course_id_name' => 'CURSO',
                           //required, field name about original course id
              )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
$output[] = array(
       'original_user_id_value' =>$orig_user_id_value[$i],
       'original_course_id_value' =>$orig_course_id_value[$i],
       'result' => $results[$i]);
array
   0 =>
     array
        'original_user_id_value' => string '1,2'
              // original users id that you sent like param
        'original_course_id_value' => string '1'
              // original course id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSUnSubscribeUserFromCourse

This function unsuscribe many users from courses into dokeos
Input params
Follow the new structure:

$params = array(
       'userscourses' =>array(               // array of userscourses params, you can
unsuscribe many users from many courses
              array(
                    'original_user_id_values' => array('1','2'),
                           // required, array of field value about original user id
                    'original_user_id_name' => 'USER',
                           //required, field name about original user id
                    'original_course_id_value' => '1',
                           //required, field value about original course id
                    'original_course_id_name' => 'CURSO',
                           //required, field name about original course id
             )
       ),
       'secret_key' => sha1('123') //required, secret key ("your IP address and
security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_user_id_value' => string '1,2'
              // original users id that you sent like param
       'original_course_id_value' => string '1'
              // original course id that you sent like param
       'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSSuscribeUsersToSession

This function suscribe many users to sessions into dokeos
Input params
Follow the new structure:

$params = array(
       'userssessions' =>array(
              // array of userssessions params, you can suscribe many users
              //into many sessions
              array(
                     'original_user_id_values' => array('1','2'),
                           // required, array of field value about original user id
                     'original_user_id_name' => 'USER',
                           //required, field name about original user id
                     'original_session_id_value' => '1',
                           //required, field value about original session id
                     'original_session_id_name' => 'SESION',
                           //required, field name about original session id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_user_id_value' => string '1,2'
              // original users id that you sent like param
       'original_session_id_value' => string '1'
              // original session id that you sent like param
       'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSUnsuscribeUsersFromSession

This function unsuscribe many users from sessions into dokeos
Input params
Follow the new structure:

$params = array(
       'userssessions' =>array(
              // array of userssessions params, you can unsuscribe many users
              // from many sessions
              array(
                     'original_user_id_values' => array('1','2'),
                           // required, array of field value about original user id
                     'original_user_id_name' => 'USER',
                           //required, field name about original user id
                     'original_session_id_value' => '1',
                           //required, field value about original session id
                     'original_session_id_name' => 'SESION',
                           //required, field name about original session id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_user_id_values' => string '1,2'
              // original users id that you sent like param
        'original_session_id_value' => string '1'
              // original session id that you sent like param
        'result' => string '1'
              // '1' if the operation is OK, '0' otherwise

DokeosWSSuscribeCoursesToSession

This function suscribe many courses to sessions into dokeos
Input params
Follow the new structure:

$params = array(
       'coursessessions' =>array(
              // array of coursessessions params, you can suscribe many
              // courses from many sessions
              array(
                     'original_course_id_values' => array('1','2'),
                     // required, array of field values about original course id
                     'original_course_id_name' => 'CURSO',
                     //required, field name about original course id
                     'original_session_id_value' => '1',
                     //required, field value about original session id
                     'original_session_id_name' => 'SESION',
                     //required, field name about original session id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address
              // and security key from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_course_id_values' => string '1,2'
              // original courses id that you sent like param
       'original_session_id_value' => string '1'
              // original session id that you sent like param
       'result' => string 'RELIGION,MATE'
              // deparment urls of courses suscribed, '0' otherwise

DokeosWSUnsuscribeCoursesFromSession

This function unsuscribe many courses from sessions into dokeos
Input params
Follow the new structure:

$params = array(
       'coursessessions' =>array(
                    // array of coursessessions params, you can unsuscribe
                    //many courses from many sessions
              array(
                    'original_course_id_values' => array('1','2'),
                    // required, array of field values about original course id
                    'original_course_id_name' => 'CURSO',
                    //required, field name about original course id
                    'original_session_id_value' => '1',
                    //required, field value about original session id
                    'original_session_id_name' => 'SESION',
                    //required, field name about original session id
             )
       ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
       'original_course_id_values' => string       '1,2'
              // original courses id that you      sent like param
       'original_session_id_value' => string       '1'
              // original session id that you      sent like param
       'result' => string '1'
              // '1' if the operation is OK,       '0' otherwise

DokeosWSCourseDescription

This function return categories list from course description, if the value is a string '' it
means there are not title and content by category. Actually exits only 8 categories what you
can modify title and content, see course description tool in your portal dokeos
Input params
Follow the new structure:

$params = array(
       'original_course_id_name' => 'CURSO',
              // required, field name about original course id
       'original_course_id_value' => '2',
              // required, field value about original course id
       'secret_key' => sha1('123')
              // required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
 );

Results
Return categories list about course description

DokeosWSEditCourseDescription

This function modify title and content about categories from course description
Input params
Follow the new structure:

$params = array(
       'course_desc' =>array(
              // array course description params, you can create modify
              // many titles and contents
              array(
                     'course_desc_id' => '1',
                            //required, category id from course description (1-8),
                            // see results of DokeosWSCourseDescription function
                            //for more information
                     'course_desc_title' => 'Descripcion',
                            //required, title about a category you want modify
                     'course_desc_content' => 'descripcion mod',
                            //required, content about a category you want modify
                     'original_course_id_name' => 'CURSO',
                            //required, field name about original course id
                      'original_course_id_value' => '2'
                             //required, field value about original course id
             )
        ),
        'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              //from dokeos") encrypted with sha1
);

Output params
The results are shown like follow structure:
array
   0 =>
     array
        'original_course_id_value' => string '10'
              // original course id that you sent like param
        'result' => string '1'
              // '1' if operation is OK, 0 otherwise

NOTE: In all functions above if your secret key param is incorrect they'll return an empty array

DokeosWSCreateUserPasswordCrypted

This function adds only a user into dokeos, the password param (your password with a
salt) is encrypted. It's very important sent the salt into an extra field param with
field_name 'salt', otherwise the user will be able login in .
Input params
Follow the new structure:

$params =
        array(
              'firstname' => 'Christian',                 // required
              'lastname' => 'XXX',                        // required
              'status' => '5',
                      // required, (1 => teacher, 5 => learner)
              'email' => 'XXX@gmail.dom',
                      // optional, follow the same format (example@domain.com)
              'loginname' => 'usuarioIV',                 // required
              'password' => md5('--christian--12345--'),
                      // required, it's important to define the salt
                      // into an extra field param
              'encrypt_method' => 'md5',          // required, check if the encrypt
                      // is the same than dokeos configuration
              'language' => 'spanish',                    // optional
              'phone' => '12345678',                      // optional
              'expiration_date' => '0000-00-00 00:00:00',
                      // optional, follow the same format
              'original_user_id_name' => 'USER',
                      //required, field name about original user id
              'original_user_id_value' => 'A5',
                      //required, field value about original user id
               'extra' => array (
                      //required, you must define at least field name 'salt'
                      // with the same value than your encryption
                      array(
                             'field_name' => 'salt',
                             'field_value' => 'christian'),
                      array(
                             'field_name' => 'DNI',
                             'field_value' => '123456')
         ),
         'secret_key' => sha1('123')
               //required, secret key ("your IP address and security key
               // from dokeos") encrypted with sha1
         );

Output params
A string about result:
-1 - Secret key is incorrect
        new user id from dokeos - If the operation is OK
0 - If the operation has failed

DokeosWSEditUserPasswordCrypted

This function edits only a user into dokeos, if you edit password it must be encrypted with
sha1 (password with a salt), and don't forget define the salt into extra field with field name
'salt', otherwise the user will be able log in.
Input params
Follow the new structure:

$params =
         array(
               'original_user_id_value' => '10',
                      //required, field value about original user id
               'original_user_id_name' => 'USER',
                      //required, field name about original user id
               'firstname' => 'Christian',               // required
               'lastname' => 'XXX',                      // required
               'username' => 'usuarioA',                 // required
               'password' => md5('--christian--12345--'),
                      // required, it's important to define the salt into
                      // an extra field param
               'encrypt_method' => 'md5',
               // required, check if the encrypt is the same
               // than dokeos configuration
               'email' => 'XXX@gmail.dom',
               // optional, follow the same format (example@domain.com)
               'status' => '5', // required, (1 => teacher, 5 => learner)
               'phone' => '12345678', // optional
               'expiration_date' => '0000-00-00 00:00:00',
                      // optional, follow the same format
               'extra' => array (
                      //required, you must define at least field name 'salt'
                     // with the same value than your encryption
                     array('field_name' => 'salt',
                           'field_value' => 'christian'),
                     array('field_name' => 'DNI',
                           'field_value' => '123456')
              ),
              'secret_key' => sha1('123')
                     // required, secret key ("your IP address and security
                     // key from dokeos") encrypted with sha1
);

Output params
A string about result:
-1 - Secret key is incorrect
 1 - If the operation is OK
 0 - If the operation has failed

DokeosWSCreateUser

This function adds only a user into dokeos, the password param is not encrypted
Input params
Follow the new structure:

$params =
       array(
              'firstname' => 'Christian',            //required
              'lastname' => 'XXX',                   //required
              'status' => '5',
                     //required, (1 => teacher, 5 => learner)
              'email' => 'XXX@gmail.dom',
                     //optional, follow the same format (example@domain.com)
              'loginname' => 'usuario1',             //required
              'password' => '12345',                 //required
              'language' => 'spanish',               //optional
              'phone' => '12345678',                 //optional
              'expiration_date' => '0000-00-00 00:00:00',
                     //optional, follow the same format
              'original_user_id_name' => 'USER',
                     //required, field name about original user id
              'original_user_id_value' => '1',
                     //required, field value about original user id
              'extra' => array (
                     //optional, extra fields about user's extras data,
                     //you can insert several extra fields
                     array('field_name' => 'direccion',
                           'field_value' => 'Arquimedes 260'),
                           // field name with your field value
                     array('field_name' => 'DNI',
                           'field_value' => '416766220')
                           // field name with your field value
              ),
       'secret_key' => sha1('123')
              //required, secret key ("your IP address and security key
              // from dokeos") encrypted with sha1
     );

Output params
A string about result:
          -1 - Secret key is incorrect
            new user id from dokeos - If the operation is OK
          0 - If the operation has failed

DokeosWSEditUser

This function edits only a user into dokeos, the password param is not encrypted
Input params
Follow the new structure:

$params =
       array(
              'original_user_id_value' => '1',
                     //required, field value about original user id
              'original_user_id_name' => 'USER',
                     //required, field name about original user id
              'firstname' => 'Christian',             //required
              'lastname' => 'XXX',                    //required
              'username' => 'usuario1',               //required
              'password' => '12345',                  //required
              'email' => 'XXX@gmail.dom',
                     //optional, follow the same format (example@domain.com)
              'status' => '5',
                     //optional, (1 => teacher, 5 => learner)
              'phone' => '12345678',                  //optional
              'expiration_date' => '0000-00-00 00:00:00',
                     //optional, follow the same format
              'extra' => array (
                     //optional, extra fields about user's extras data,
                     // you can insert several extra fields
                     array('field_name' => 'direccion',
                            'field_value' => 'Arquimedes 260'),
                            // field name with your field value
                     array('field_name' => 'DNI',
                            'field_value' => '416766220')
                            // field name with your field value
              ),
              'secret_key' => sha1('123')
                     //required, secret key ("your IP address and security key
                     // from dokeos") encrypted with sha1
           );

Output params
A string about result:
          -1 - Secret key is incorrect
            1 - If the operation is OK
          0 - If the operation has failed

h3. DokeosWSDeleteUser

This function only disable only a user into dokeos, if you want delete from database you
can delete it from user list into your dokeos portal
Input params
Follow the new structure:

$params =
       array(
               'original_user_id_name' => 'USER',
                     //required, field name about original user id
               'original_user_id_value' => '1',
                     //required, field value about original user id
               'secret_key' => sha1('123')
                     //required, secret key ("your IP address and security key
                     // from dokeos") encrypted with sha1
             );

Output params
A string about result:
          -1 - Secret key is incorrect
            1 - If the operation is OK
          0 - If the operation has failed

Updated by Yannick Warnier over 9 years ago · 5 revisions