Pagination and Error Handling

Pagination

If all the results cannot be returned in a single request on a list endpoint, you'll have to paginate and make multiple requests. The result contains a pagination field:

{
  "data": [{ ... }]
  "pagination": {
    "hasNextPage": true,
    "nextPageCursor": "MTA0"
  };
}

If hasNextPage is true, you can get more data by passing the nextPageCursor into another request. Keep all of the other parameters the same as in the previous request.

curl "https://api.getflipturn.com/api/charging-sessions?startTimeAfter=2023-03-24T01:18:05.000Z&nextPageCursor=MTA0" -H "Authorization: Bearer {token}"

Once you see "hasNextPage": false, then there is no more data to retrieve.

Rate Limits

Each API key is limited to making 200 requests per minute. When fetching charging sessions with the includeIntervals query parameter, the API key is limited to 1 concurrent request. Certain endpoints enforce stricter rate limits, such as charger health. If you need a higher rate limit, please get in touch and we can discuss the use case.

Errors and Response Codes

When the API is not able to return a successful response, it will return an HTTP response code of 400 or above, along with an error message. Response codes in the 400 category indicate an issue with the request, and 500 indicates an internal issue on Flipturn's side.

For example, this request with an incorrect API key:

curl "https://api.getflipturn.com/api/charging-sessions" -H "Authorization: Bearer invalid_key"

Would result in a response like the following:

Status code: 401

Response:
{
  "error": "Invalid API key"
}

Here are some errors you can get:

  • 400 - invalid parameters passed to API endpoint

  • 401 - invalid API key or Authorization header

  • 404 - endpoint doesn't exist

  • 429 - exceeded rate limit

Last updated