JSON Response Envelope

All successful responses should have an HTTP status code 200 and should be formatted as JSON objects with a single key, data, that contains the response data. For POST requests and single entity GET requests (i.e. GET /v1/orders/123), the data attribute should be an object, while collection GETs (i.e. GET /v1/stores/) should return an array of objects.

If an endpoint supports pagination, an additional pagination key should be returned with an object containing the page size per_page, page number current_page (1-indexed), and the number of pages accessible total_pages.

{
    "data": { },
    "pagination": {
        "current_page": 1,
        "per_page": 20,
        "total_pages": 15
    }
}
Was this article helpful?
0 out of 0 found this helpful