Consuming APIs Practices of Restful Services

By -

All the famous Web 2.0 services are related to Representational State Transfer (REST) under the W3C Technical advisory group.
Developers are supposed to be familiarized with the layout of the APIs to make sure the purpose the services they have intentions to use. Developers who are connected with REST API can have a look at the API documentation of facebook to get an idea about the effective documentation.

JSON over XML

If the payload support is given by REST API for using XML format and JSON both, the recommended one is JSON as it is lighter and feasible than the XML one. The problem with XML is that its parsers can hit bugs. Although JSON is independent from language, effective for the language of C-family including, C, C#, C++, Java Script, Java, Python, and others.
Adding to allegiance, if you have support of SSL by REST, this should be would be the best to use as it prevents the need for implementing a simple access token which results in avoiding lots of hassles in your application. Even less than 20% overhead is counted while in processing.

Idempotence of API

It should be cleared that all the ALPs are not Idempotence. If you have the availability of another API, you can use it in case variation in your API result.

Updates

The similarity of input payload PUT(update) call and output payload of GET(read) call is the real beauty of REST. You should get the state of resource to be safe from any conflict while during updates.

For example:

1. Making the fetch call first.

Request: GET //VIP/Person/23.
Response payload:

2. Making changes to the output as needed.

3. Updating the server with the information.

Request: PUT //VIP/Person/23.
Request payload:

Concurrency Conflicts

The last update win whenever there are two different updates at the same time to the same source.

Illahi Bux

A freelancer Web & Mobile Developer,Trainer and Project Rescue. Help people in web & mobile developing for a variety of clients both near and far to grow the business.live truthfully and embrace their lives through creativity.

A freelancer Web & Mobile Developer,Trainer and Project Rescue. Help people in web & mobile developing for a variety of clients both near and far to grow the business.live truthfully and embrace their lives through creativity.

Leave a Reply

Your email address will not be published. Required fields are marked *