A RESTful web service is a web API implemented using HTTP and REST principles.
REST is an architectural style for web services and it is predominantly used to develop web services for the enterprise applications where performance, scalability, and ease of development are very important considerations.
The REST architecture is an alternative to SOAP and offers certain characteristics:
• Lightweight and easy to build
• Easy to debug
• All resources are accessible using the HTTP
API Design and Development
The API could be accessed by mobile web application or mobile application developed in Android, iOS, etc.
Parsing JSON rather than a more complex format such as XML is faster and easier to perform on a mobile device.
The API could be built using Spring MVC, Jersey JAX-RS library which leverage Java annotations making the definition of resource mapping very easy to do in a very declarative manner. The Jackson JSON/Java library or Google Gson library could be used to marshal or un-marshal Java objects into JSON format.
The scripting languages like Perl, PHP etc. coluld also be used to develop RESTful API.
All request and response headers must have a content type “application/json”, which means all the complex queries and responses must be in the form of JSON arrays or JSON objects.
Since REST API is stateless, queries for large volume of data have to provide limit for the number of records returned and an offset where to start.
Testing and Integration
Easy to test using HTTP requests from Soap UI, REST Client or web browser.
Securing REST API
REST API could be secured by using the following ways:
• Session based authentication by using session token
• API key in the request header
Benefits of Using the REST API
• Use standard HTTP method call-outs
• Standards-based security
• Data model & Standard objects
• Flexible formats like the XML or JSON format.
|RESTful API - Mobility Solutions.png||16.24 KB|