Fork me on GitHub

Usage

Test JSP

There is a JSP that allow to run test on the module-directory-rest. It is accessible through the following link :

jsp/admin/plugins/directory/modules/rest/TestDirectoryRest.jsp

Note : To access to this JSP, one must be authenticated in the Back-Office. The filter tags must also be commented in the file directory-rest.xml so the module won't use the security, otherwise, an HTTP 401 response will be returned.

URLs syntax

Retrieve the information of one or several record in format XML or JSON

XML syntax :

  • To get all the records :
http://myhost/mywebapp/rest/directory/{id_directory}/records
or
http://myhost/mywebapp/rest/directory/{id_directory}/records.xml
  • To get one record :
http://myhost/mywebapp/rest/directory/{id_directory}/record/{id_directory_record}
or
http://myhost/mywebapp/rest/directory/{id_directory}/record/{id_directory_record}.xml

JSON syntax :

  • To get all the records :
http://myhost/mywebapp/rest/directory/{id_directory}/records.json
  • To get one record :
http://myhost/mywebapp/rest/directory/{id_directory}/record/{id_directory_record}.json

Create/Complete a record

To create/complete a record, a form using the method POST and having an entype multipart/form-data and with the following parameters are needed :

Parameter's name Parameter's type Description
id_directory text ID of the directory (mandatory)
id_directory_record text ID record (if not empty string, then is it the operation to complete)
http://myhost/mywebapps/rest/directory/record

Update a record

To update a record, it is exactly the same as creating/completing a record, except that the header of the HTTP request must have the method PUT.

Remove a record

To remove a record, the header of the HTTP request must have the method DELETE and have the following parameter :

Parameter's name Parameter's type Description
id_directory_record text ID record
http://myhost/mywebapps/rest/directory/record