Mobile Zone is brought to you in partnership with:

Seasoned technology professional with strong experience in developing desktop applications, web applications, mobile web applications, web services platform based on multi-tiered distributed architecture, legacy modernization, and SOA. Senthamizh Chelvi has posted 8 posts at DZone. You can read more from them at their website. View Full User Profile

RESTful API for Mobility Solutions

01.09.2014
| 5647 views |
  • submit to reddit

Introduction

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
•  Extensible
•  Scalable
•  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.

API Operations

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:
•  OAuth2
•  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.

AttachmentSize
RESTful API - Mobility Solutions.png16.24 KB
Published at DZone with permission of its author, Senthamizh Chelvi Kaliyaperumal.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

sami prakash replied on Mon, 2014/01/20 - 11:25am

useful guidance for java middle tier developers

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.