Project

General

Profile

Web services » History » Revision 8

Revision 7 (Yannick Warnier, 30/06/2010 03:34) → Revision 8/12 (Yannick Warnier, 30/06/2010 03:45)

h1. Web services

{{>toc}}

h2. Chamilo > 1.8.7

The following documentation gives a complete description of the behaviour of the Chamilo Web Services.
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.

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.

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:
<pre>$security_key = 'abcdef1234567890';
$ip_address = '134.23.25.34';
$secret_key = sha1($ip_address.$security_key);</pre>

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/soap.php. You can check the list of available functions through a call to http://campus.chamilo.org/main/webservices/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).

h3. External identifiers

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

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.

h3.
WSUser.DisableUser

Disables one user

h4. Input


<pre>
array(
'secret_key' => 'abcdef1234567890',
'user_id_field_name' => 'external_user',
'user_id_value' => '1504',
);
</pre>

h4. Output


<pre>
nothing (or error message)
</pre>

h3. WSUser.DisableUsers

Disables several users in one call.

h4. Input


<pre>
array(
'secret_key' => 'abcdef1234567890',
array(
0=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1504'),
1=>array('user_id_field_name' => 'external_user', 'user_id_value' => '1582'),
)
);
</pre>

h4. Output


<pre>
array(
0=>array('code'=>0,'message'=>'Operation was successful'),
1=>array('code'=>0,'message'=>'Operation was successful'),
);

</pre>

h3. WSUser.EnableUser

Enables one user

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.EnableUsers

Enables several users in one call.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.DeleteUser

Deletes one user

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.DeleteUsers

Deletes several users in one call

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.CreateUser

Creates one user

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.CreateUsers

Creates several users in one call.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.EditUser

Edits one user

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSUser.EditUsers

Edits several users in one call.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.DeleteCourse

Deletes one course

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.DeleteCourses

Deletes several courses in one call.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.CreateCourse

Creates one course

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.CreateCourses

Creates several courses in one call.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.EditCourse

Edits one course

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.ListCourses

Lists courses

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.SubscribeUserToCourse

Subscribes one user to one course

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.UnsubscribeUserFromCourse

Unsubscribes one user from one course.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.GetCourseDescriptions

Gets the list of course descriptions.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSCourse.EditCourseDescription

Edits one description of one course.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.CreateSession

Creates one session.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.DeleteSession

Deletes one session.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.EditSession

Edits one session.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.SubscribeUserToSession

Subscribes one user to one session.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.UnsubscribeUserFromSession

Unsubscribes one user from one session

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.SubscribeCourseToSession

Subscribes one course to one session.

Input
<pre>
</pre>

Output
<pre>
</pre>

h3. WSSession.UnsubscribeCourseFromSession

Unsubscribes one course from one session

Input
<pre>
</pre>

Output
<pre>
</pre>

h2. 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:
<pre>$security_key = 'abcdef1234567890';
$ip_address = '134.23.25.34';
$secret_key = sha1($ip_address.$security_key);</pre>

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

h3. DokeosWSCreateUsers

This function adds users into dokeos/chamilo, the password param is not encrypted
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre> 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
)
)</pre>

h3. 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:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre> 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
</pre>

h3. DokeosWSEditUsers

This function edits users into dokeos, the password param is not encrypted
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre> 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
</pre>

h3. 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:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. 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:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSCreateCourse

This function creates courses into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSCreateCourseByTitle

This function creates courses into dokeos by title
Input params
Follow the new structure:
<pre>$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
);</pre>

Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSEditCourse

This function edits courses into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. 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:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSCreateSession

This function creates sessions into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSEditSession

This function edits a session into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSDeleteSession

This function deletes a session from database into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSSubscribeUserToCourse

This function suscribe many users to a course into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>$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
</pre>

h3. DokeosWSUnSubscribeUserFromCourse

This function unsuscribe many users from courses into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSSuscribeUsersToSession

This function suscribe many users to sessions into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSUnsuscribeUsersFromSession

This function unsuscribe many users from sessions into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSSuscribeCoursesToSession

This function suscribe many courses to sessions into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. DokeosWSUnsuscribeCoursesFromSession

This function unsuscribe many courses from sessions into dokeos
Input params
Follow the new structure:
<pre>$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
);</pre>
Output params
The results are shown like follow structure:
<pre>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
</pre>

h3. 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:
<pre>$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
);</pre>
Results
Return categories list about course description

h3. DokeosWSEditCourseDescription

This function modify title and content about categories from course description
Input params
Follow the new structure:
<pre>
$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
);
</pre>
Output params
The results are shown like follow structure:
<pre>
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
</pre>
NOTE: In all functions above if your secret key param is incorrect they'll return an empty array

h3. 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:
<pre>
$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
);</pre>
Output params
A string about result:
<pre>-1 - Secret key is incorrect
new user id from dokeos - If the operation is OK
0 - If the operation has failed
</pre>

h3. 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:
<pre>$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
);
</pre>
Output params
A string about result:
<pre>-1 - Secret key is incorrect
1 - If the operation is OK
0 - If the operation has failed
</pre>

h3. DokeosWSCreateUser

This function adds only a user into dokeos, the password param is not encrypted
Input params
Follow the new structure:
<pre>$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
);
</pre>
Output params
A string about result:
<pre> -1 - Secret key is incorrect
new user id from dokeos - If the operation is OK
0 - If the operation has failed
</pre>

h3. DokeosWSEditUser

This function edits only a user into dokeos, the password param is not encrypted
Input params
Follow the new structure:
<pre>
$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
);
</pre>
Output params
A string about result:
<pre>
-1 - Secret key is incorrect
1 - If the operation is OK
0 - If the operation has failed
</pre>
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:
<pre>
$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
);
</pre>
Output params
A string about result:
<pre>
-1 - Secret key is incorrect
1 - If the operation is OK
0 - If the operation has failed
</pre>