Design and Develop REST API (RESTful Web services: The basics)

What is API

In computer programming, an Application Programming Interface (API) is a set of subroutine definitions, protocols, and tools for building application software. In general terms, it is a set of clearly defined methods of communication between various software components. [Wikipedia]

For www and remote servers, An API isn’t the same as the remote server — rather it is the part of the server that receives requests and sends responses. [By Petr Gazarov – medium.freecodecamp.com]

Example of some popular API are Google maps  API, YouTube API, Facebook API etc.

What is REST API

History of REST:

REST was defined by Roy Fielding in his 2000 PhD dissertation “Architectural Styles and the Design of Network-based Software Architectures” at UC Irvine. Fielding developed the REST architectural style in parallel with HTTP 1.1 of 1996–1999, based on the existing design of HTTP 1.0 of 1996.

In a retrospective look at the development of REST, Roy Fielding said:

Throughout the HTTP standardization process, I was called on to defend the design choices of the Web. That is an extremely difficult thing to do within a process that accepts proposals from anyone on a topic that was rapidly becoming the center of an entire industry. I had comments from well over 500 developers, many of whom were distinguished engineers with decades of experience, and I had to explain everything from the most abstract notions of Web interaction to the finest details of HTTP syntax. That process honed my model down to a core set of principles, properties, and constraints that are now called REST. – [Wikipedia]

Introduction:

If we take one example of popular Android app : Evernote, all the data of the app is stored in a cloud database and communication between app and the database can be done using a REST API. If we uninstall the app anytime, no loss of data as data is stored in a cloud database and if we install the app and login all our data will be visible. So, REST API is a good architectural option to do the communication between the app and the server, if we want to manages all the user data on a central database.

REST (Representational State Transfer) defines a set of architectural principles by which you can design Web services that focus on a system’s resources, including how resource states are addressed and transferred over HTTP by a wide range of clients written in different languages.

Read More