Skip to content

Response Structure

Response

The "response" in an API call refers to the data sent back by the server post-request processing. Typically in JSON format, this structured data can contain a data payload, metadata like status codes or timestamps, and error messages. HTTP status codes, such as 200 for success or 404 for not found, often accompany the response. A sample JSON response might include fields like "status", "message", and "result".

Successful request

{
"status":"Ok",
"message":"Success"
"result":[]
}

A "success request" in the context of an API call denotes that the server has successfully processed and fulfilled the client's request. When an API call results in a success request, the server typically returns an HTTP status code of 200 OK to indicate that the operation was completed as expected. Alongside this status code, the server's response often includes the requested data or any relevant information pertaining to the successful operation. For instance, if a client requests user information, a successful response might contain a JSON object with details like the user's name, email, and ID.

Failed request

{
    "status": "Not ok",
    "message": "Invalid auth code",
    "result": []
}

A "failure request" refers to a situation where the server is unable to fulfill or process the client's request successfully. This can occur due to various reasons, such as invalid input parameters, authentication issues, server errors, or other unforeseen issues. When a failure request occurs, the server typically responds with an appropriate HTTP status code, such as 4xx for client errors (e.g., 400 for bad request, 401 for unauthorized) or 5xx for server errors (e.g., 500 for internal server error). Alongside the status code, the response might include error messages or additional details to help diagnose the issue.

Data types:

  • Values in JSON responses are of types string, int, float, or boolean.

  • Timestamp (datetime) strings in the responses are represented in the form yyyy-mm-dd hh:ss, set under the Indian timezone (IST) — UTC+5.5 hours.

  • A date string is represented in the form yyyy-mm-dd.