User Tools

Site Tools


api

This is an old revision of the document!


LUCY REST API - Background Info

Lucy API is a RESTful web service. The API does not keep the client's state and all requests can be performed in any order.

Requirements

Some general requirements are:

  • The service uses JSON as the only data interchange format, all API responses are in JSON, most request parameters are expected to be in JSON.
  • All requests to API should have a "Content-Type" header set to "application/json".
  • All requests should be performed strictly over HTTPS protocol. Plain HTTP requests to API will be rejected by server.

Authentication

Lucy API uses JWT (JSON web tokens) for authentication. The token should be obtained by sending an Authentication request before issuing any other requests (see Authentication request description below for details). The obtained authentication token should be specified in the "Authorization" HTTP header with "Bearer" scheme, for all subsequent requests. The only request that doesn't require authentication is the authentication request itself, all other requests require a token. Example:

Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI
6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONF
h7HgQ

The client should store the token locally and keep it until the token expires. The expiration date and time is specified in the token header. Please check out https://jwt.io/ for JWT token formation description and libraries for various programming languages.

Resources

Resources are used when getting some data from Lucy API or creating/changing some objects in Lucy. Resource structure is always the same and does not depend on the type of action you do - whether you are getting information from Lucy or creating an object, the object representation doesn't change. For example, campaigns - when you get a list of campaigns or get a single campaign, the structure doesn't differ from what the server expects when you are creating a new campaign. The only difference is links - when you are posting/putting something to API, the server does not expect any links (and ignores them if they are present in request). The links are only used for exposing relations in GET requests. For specifying relations with other existing objects in system, please use integer IDs.

api.1505835209.txt.gz · Last modified: 2019/07/25 12:52 (external edit)