API Basics
API is based on REST principles. The client makes HTTP requests to Paysera system,
providing information about the intended action.
HTTP verbs GET
, POST
, PUT
and DELETE
are used in this API.
In POST
and PUT
requests
content request is usually provided in JSON format by using UTF-8 encoding. If some other format is used, it is
specified in the method description.
Paysera system provides JSON encoded response to each request. HTTP status code identifies the
status of the request - for successful requests, status code 200
is returned.
In case of an error, some information like a code and description is provided to debug the problem more easily,
so that the client could try to decode the response even if an error code is returned.
If some elements of returned structure are optional, they can be skipped. That is, null
is not returned,
the JSON element is entirely skipped. Client should handle these situations and do not assert that the element will
definitely exist if it's optional.
Errors and response codes
In case of a success, API returns status code200
. In case of an error, the status code differs from case to case.
The client should always check the response status code to know what kind of response is given.
In case of an error, response body is the error object. It's structure is provided in the table below.
error
error_description
error_uri
-
invalid_request
(status code400
) - Request content is invalid -
invalid_parameters
(status code400
) - Some required parameter is missing or it's format is invalid -
invalid_state
(status code409
) - Requested action cannot be made to the current state of resource -
unauthorized
(status code401
) - Authentication parameters are not provided or are incorrect -
forbidden
(status code403
) - The client has no right to access the requested resource or perform the requested action -
not_found
(status code404
) - Resource was not found internal_server_error
(status code500
) - Unexpected internal system errornot_acceptable
(status code406
) - Unknown request or response format
Error response example
HTTP/1.1 403 Forbidden Content-type: application/json;charset=utf-8
{ "error": "forbidden", "error_description": "This resource is assigned to other project, client has no rights to read it" }