API responses
API responses indicate if an API request is successful or not. A response consists of an HTTP response status code and a response body that indicates a successful response or an error response.
Hence, an API response consists of the combination of the following:
HTTP response status code + response body (success response or error response)
HTTP response status code
HTTP response status codes indicate if your request was successful or not. They are of the following types:
Response body
Many requests return a response body in JSON format. The responses can be of the following types:
Success response
If your API request has gone through successfully, you get the success response with the required parameters, usually in JSON format.
For example, the success response for the /token
endpoint is:
{"access_token": "...","token_type": "bearer","expires_in": "...","scope": "...","refresh_token": "..."}
Error response
If your API request doesn't go through successfully, you get an error response that consists of the following:
- error HTTP status code
- error code (usually carries different info than status code)
- error message
For example, an error response can look like:
400,{'errorCode':'INVALID_QUERY_PARAM',‘message’:'query param x must be either 1 or 2'}