E
E
Egorus2014-10-02 12:28:16
RESTful API
Egorus, 2014-10-02 12:28:16

What is rest api?

What is rest api ? Please explain in understandable terms. Wikipedia, alas, could not answer.
A rest api specialist should understand, for example, api vk ? Or are they different things? What is the difference?
Thanks a lot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Ezhgurov, 2014-10-02
@eandr_67

Social networking APIs are quite typical examples of REST API implementations.
REST (RESTful) - these are the general principles for organizing the interaction of an application / site with a server using the HTTP protocol. The peculiarity of REST is that the server does not remember the state of the user between requests - in each request information is transmitted that identifies the user (for example, a token obtained through OAuth authorization) and all the parameters necessary to perform the operation.
All interaction with the server is reduced to 4 operations (4 is a necessary and sufficient minimum, in a specific implementation of the types of operations there may be more):
1. receiving data from the server (usually in JSON or XML format)
2. adding new data to the server
3 . modification of existing data on the server
4. deleting data on the server
The operation of obtaining data cannot lead to a change in the state of the server.
Each type of operation uses its own HTTP request method:
1. receiving - GET
2. adding - POST
3. modifying - PUT
4. deleting - DELETE
I.e. :
GET request /rest/users - getting information about all users
GET request /rest/users/125 - getting information about the user with id=125
POST request /rest/users - adding a new user
PUT request /rest/users /125 - change information about user with id=125
DELETE request /rest/users/125 - delete user with id=125

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question