What is REST
At Jexia we like to make the way you can develop applications easier. That’s why we provide you with a backend system to create your own RESTful API’s. But what exactly is REST? And why it is so popular? REST is a rather broad concept and we cannot cover all of its aspects, but in this article I will try to cover the most important aspects of why REST is so easy and straightforward to use.
Representations instead of actual data
REST is an acronym that stands for Representational State Transfer. Literally,this means that we transfer the state of something by its representation. One of the key principles of REST is that only representations of resources are transferred between client and server. The representation is the form in which it is exposed to the user. The resource is the actual set of data that has been stored into the database.
Exchange of representations
The interaction state is only at client side. Server and client are separated and communicate with each other through the HTTP protocol. Each time the client needs to get, post, update or delete data from a specific resource it makes a request to the server to carry out the action. The server responds by sending a representation of the data in JSON, XML or another format and then disconnects. The exchange of representations between the server and client can flow both ways. The clients sends out a representation of a new resource in a POST action, the server creates the actual resource. This exchange of representation means you never have access to the real resource in the database. You send or get back a representation of that resource.
Uniform Resource Identifier
Resources can be accessed through an URI. An URI designates exactly one resource. It is basically a pointer to that resource.
To insert a new customer in the system you might use:
To get information about customer 5440 you would use:
To see the orders that this customer has you would use
One of the biggest advantages of REST is that it is stateless. This means the server doesn’t hold any information about the client’s state. Every request happens in complete isolation. There is no track of what should happen or in what order.
What problem does REST resolve?
REST resolves the problem of reserving pieces of memory on the server to store information about a state using session variables. Normally this is done by storing information about the state on the server into a session variable. The server would reserve a little bit of memory for this. Imagine that you have to store information about the login state of users into the database until the session is destroyed. By the time your system has thousands of users, the server can easily run out of memory. In terms of scalability this is probably not the best way to handle. Using REST state issues are handled on the client side and no session data will be stored on the server.
How we help you to use the advantages of REST
In a REST architecture server and client are separate. Because it is stateless it will make your application better scalable. Our aim at Jexia is to help you create applications faster without worrying over complicated data storage options that sooner or later can hit performance, reliability and security issues. We generate the REST API's for you, so you can use them in your application directly or by making use of our SDK's.