Rest API Basics

Rest API uses HTTP verbs and a RESTful endpoint structure to provide programmatic access to read/write data.

 

HTTP Methods

API supports most commonly used HTTP methods (GET, POST, PUT and DELETE). Each method should be used depending on the type of operation you are performing.

GET To fetch a resource
POST To create a new resource
PUT To update existing resource
DELETE To delete a resource

 

HTTP Status Codes

HTTP status codes in the response body tells client application what action should be taken with the response. For an example if the response code 200, it means on the server side the request is processed successfully and you can expect updated data in the response. As well if the status code is 401, the request is not authorized. An example cause for 401 could be api key is invalid.

200 OK
201 Created
304 Not Modified
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
422 Unprocessable Entity
500 Internal Server Error

 

The JSON Response

On calling every API request a JSON response will be issued with a HTTP status code. On the client side you have to verify the response http status code. If the status is 200, the request is processed successfully. Also you can notice a “error” node in the response. If the error value is true, that means some error occurred while processing the user data.

If the request is missing mandatory parameters the following json will be issued.

You can find more details from API’s error codes page with the corresponding error code.