General information about API in CleverStyle CMS
- JSON request data are accepted if Content-Type: application/json header exists
-
Local requests requires session input parameter, which should contain current user session (either in query string or in body)
- jQuery is initialized with this parameter by default, so there is no need to specify it for $.ajax() method
- External API access may be provided by specific protocol with additional modules (for instance, OAuth2 module provides corresponding protocol)
- All responses are accompanied with header Content-Type: application/json and, of course, in JSON format if this is not redefined by module
API
-
Error responses looks like:
{"error":"404","error_description":"404 Not Found"}
Usually, error property contains numeric http error code, but also it may be alphanumeric string, that satisfies regexp [a-z0-9_]+,
like:
{"error":"access_denied","error_description":"Invalid user session"}
Public API of System module
GET /api/System/profile:
Returns profile information of current user. List of fields, that will be returned:
- id
- login
- username
- language
- timezone
- avatar
GET /api/System/profiles/{id}:
Similar to /System/profile, returns profile information of specified user {id}, which SHOULD BE in contacts list of current user.
GET /api/System/profiles/{id},{id}:
Similar to /System/profiles/{id}, but allows to get several profiles by coma separated ids at one request. Ids, that are not contacts of current user may be ignored.
Returns array of profiles information.
GET /api/System/profile/contacts:
Returns array of id of current user contacts.