Response

Response Handling for Pivot's API

HTTP Status

Pivot uses standard and conventional HTTP Status Code for each API Response given in a single API Request. In a brief, HTTP Status code '2xx' indicates that the request is accepted and successfully processed by Pivot, '4xx' indicates that failure is caused by the information provided. (E.g. missing some required parameters, credentials is not valid). '5xx' indicates that the error is on the Pivot side.

HTTP Status List used in Pivot API

HTTP Status
Description

200 OK

The request was successful

400 Bad Request

The request could not be understood or was missing required parameters

401 Unauthorized

Authentication failed or user doesn't have permissions for requested operation

404 Not Found

Resource was not found

405 Method Not Allowed

Requested method is not supported for the resource

500 Internal Server Error

The server encountered and unexpected condition that prevented it from fulfilling the request

Timeout

Pivot sets a default API timeout of 60 seconds, if the request takes longer than 60 seconds, then Pivot will return HTTP code 408 for timeout response.

Response Format

Response Format Example

{
    "code": "00",
    "message": "OK",
    "error": {      
        // error object
    },
    "data": { 
        // resource object
    },
    "pagination": { 
        "page": 2,
        "perPage": 20,
        "totalItems": 400,
        "totalPages": 20
    }
}

Pivot API returns a uniformed response format which helps you traverse the response easily. The payload contains following information:

Code

Response code, a code that represents the success or failure of your request. The List of response codes can be found in each section of API Services

Message

A human-readable format that explains the response

Error

An extended payload that explains the error in detail. See error section

Data

Contains the response data related with the accessed resources

Pagination

In some response, like retrieve a collection or list, you can find pagination object. It is contains pagination information such as page number, how many records shows in page, total records, and total pages available

Last updated