-
Notifications
You must be signed in to change notification settings - Fork 22
RESTful API
Provided RESTful API
A RESTful web-service endpoint is available for both testing and production servers. Web-services are secured using basic authentication. When a user wants to access them he/she has to create an account first:
- Testing server:
http://uu404p22-kiv.fav.zcu.cz:8080/ - Production server:
https://eegdatabase.kiv.zcu.cz
Querying Available Templates:
A framework for generation graphical templates from a database structure is implemented.
Following URLs access templates available on the server. They support only the GET method. Both XML and JSON responses are supported, XML being the default one. JSON can be requested using the Accept header in the HTTP request:
Accept: application/json
Provided URLs:
/rest/form-layouts/count[?form=<formName>]
It returns number of available templates. There are two values – number of templates owned by the current user and number of all templates. The optional form parameter restricts result to a given form (there can be more templates for one form).
/rest/form-layouts/available[?form=<formName>&mineOnly=true]
It returns a list of available templates. Every entry of the list contains the name of the form and name of the layout. The optional form parameter restricts results to a given form. Another optional parameter is mineOnly. If set to true, only templates owned by the current user are returned.
/rest/form-layouts/form/count
Functionality of this URL is similar to the first one, but this one returns number of distinct forms for which at least one template is available.
/rest/form-layouts/form/available[?mineOnly=true]
This URL is similar to the second one, except this one returns list of names of distinct forms for which at least one template is available. The mineOnly parameter can be used again.
Transferring Templates
Only the XML format is supported. The URL is following:
/rest/form-layouts?form=<formName>&layout=<layoutName>
A client can use all CRUD operations:
- GET downloads a template from the server.
- POST uploads a new template to the server.
- PUT updates a template owned by the current user.
- DELETE deletes a template owned by the current user. For POST and PUT requests the content-type must be application/xml.
Transferring Data
The URL is following:
/rest/form-layouts/data?entity=<entityName>[&id=<recordId>]
It supports only the XML format again. Unlike with templates, only two operations are supported for this URL:
- GET downloads an odML document with all records of the given entity, or with just one record specified by the optional id parameter.
- POST uploads an odML document with a new record to the server.
In addition the service provides two more URLs so as a client can query for existing data records similarly to querying for available templates. They support both the XML and JSON responses.
-
/rest/form-layouts/data/count?entity=<entityName>This URL returns the number of records for the given entity. -
/rest/form-layouts/data/ids?entity=<entityName>Returns a list of all records' IDs (for the given entity).