REST API – first look

rest-1289036_1920.jpg

Let me answer to three fundamental questions in this topic. What is REST, for what and how use it?

Representational state transfer (or RESTful Web Services) is a software design concept for managing state information providing interoperability between computer systems. The basic idea of REST is storage objects on the server-side as available to format resources.  Communication with the server in common cases is provided using HTTP and specific URI. This is a link that consists of two parts, endpoint and unique path to the specific resource (for example GitHub Rest API endpoint is https://api.github.com and path to repositories are /users/b00sti/repos ). In which way can I connect and manage data on the server? This is provided by HTTP verbs such as:

  • GET – retrieve a representation of the addressed resource
  • HEAD – sam as GET, but returns headers, not representation of resource
  • PUT – replace addressed resource by send by us
  • POST – create a new resource
  • DELETE – delete addressed resource

A request can be realized by different formats. There is no defined standard and this way our response may be in XML, HTML, JSON. It is worth noting that there is stateless communication that means server not create a session. The important feature is caching responses by a client.

Why REST is so useful?  REST has a lot of advantages I think especially important are lightness, speed, and versatility. You can manage in an easy way your objects on the server from the plural and diverse platforms, for example, web application or mobile app. You have to worry only about the simple request, about the rest is concerned the REST server. 🙂

Using web services based on REST architecture in your application requires three simple steps:

  1. Use the appropriate URL to connect to the server.
  2. Receiving a response from the server.
  3. Processing and using the response in the application.

And the fundamental question was what is REST API? After presentation REST concept answer is pretty simple. Generally, it is API that uses RESTful URLs for managing server resources.

 


Advertisements

One thought on “REST API – first look

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s