-
Notifications
You must be signed in to change notification settings - Fork 2
API Guidelines
This guide contains instructions on the format of API request body and response body.
Schema for headers,
{
"Content-Type": "application/json; charset=utf-8",
"Access-Control-Allow-Origin": "*",
"Authorization": "Bearer <token>",
...
}
'Content-Type' key is compulsory for all the header bodies.
This will have a request body and response body. Please note the schema of both the data packets.
It contains the details sent from frontend to backend for response data. Request body should be in the following schema:
{
"action": "get_all_users",
"tzo": 330,
...
}
'action' key is compulsory for all the request bodies.
It contains the details sent from backend to frontend. Response body should be in the following schema.
{
"comment": "Login Successful",
"data": {
"name": "John",
"age" : 23
},
...
}
'comment' key is compulsory for all the response bodies.
This will have a response body. Use the same format of the schema as for POST method.
Please make sure you are handling different status codes as required with appropriate messages. Some common status codes are:
- 200 : Status OK
- 201 : Created
- 204 : No content
- 403 : Access Denied
- 404 : Not Found
- 409 : Conflict
- 500 : Server Error
- 504 : Gateway Timeout
Please visit this link for more status codes and details.
Request body and Response body will always be JSON encoded, when transferring.