Answer the question
In order to leave comments, you need to log in
They say social media API is RESTful, why?
It’s difficult for me to understand REST in principle, plus I read an article on Habré that restful api is a lie, in general, the concepts are blurred. But on the toaster I found a question where the answer was in short this:
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. deletion of data on the server
Social networking APIs are quite typical examples of REST API implementations.
Answer the question
In order to leave comments, you need to log in
https://ru.wikipedia.org/wiki/REST
I use not only POST, GET, PUT, DELETE methods in my APIs, but also additional custom ones, for example, if some component is installed in the system, I send a request using the INSTALL method, if I delete it then UNINSTALL, when I need to register a user, the method will be REGISTRATION , and when to get user access rights then GET_PERMISSIONS.
The result is a similar monotonous API structure that is very easy and natural to work with:
GET api/users/1
UPDATE api/users/1
CHANGE_PASSWORD api/users/1
GET api/users/1/persmissions
DELETE api/users/1
REGISTRATION api/users
SEARCH api/users
The API allows you to basically work with anything.
And one of the important nuances of restful is that each request is independent and self-sufficient.
That is, if you know how to request data, you do it in one request, not a sequence.
The request itself is intuitive, well, something like this
get www.site.com/server/players/online
get www.site.com/server/players/registered
get www.site.com/character/rogue/stat
get www. site.com/character/rogue/classes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question