Answer the question
In order to leave comments, you need to log in
How to briefly name the RESTful API, which, it turns out, is not RESTful at all, because it returns JSON / XML, does not use HTTP error codes, and the URLs are not the same?
I always thought that such a familiar API that returns JSON (less often XML), does not use (or almost does not use) HTTP error codes (instead of them, again, everything is in JSON) and has a free URL format, this is the REST API , and it's also a RESTful API.
Twitter also thinks so:
https://dev.twitter.com/rest/public
And today I googled this term, read a couple of articles on Habré - and I see there about some URL patterns like /images/ and /images/1, about some PUT and DELETE, about error codes ...
It turns out that that's what was originally called REST.
And what's more: Googling "rest api json", I see some articles where they write, as if with JSON, then this is not a REST API at all!
Conclusion: let's not call it a REST API.
What about in return?
And in return... Nothing.
I saw the word "JSON-pure API", but it is rare, but what if not only JSON, but also XML? Just "Pure API"? They won't understand at all, I'm afraid ...
PS Another interesting question: if the REST API is when without JSON and XML (ie, on HTML), then what kind of API is it then ?!
This is not an API, but some kind of raw meat, designed for the browser, and not for the programmer, who will still write under it.
Answer the question
In order to leave comments, you need to log in
I see some articles where they write that if with JSON, then this is not a REST API at all!
The REST Api is based on one thing: visibility of links, and one link equals one action. PUT \ DELETE are rarely used because they are not universally supported, and for full compatibility with all servers and systems, they are replaced by POST \ GET accordingly.
And REST is not SOAP, which is thoroughly saturated with formalization and protocols (the same as the enterprise), and should only return XML in a certain format. The REST API can respond the way the programmer needs it, and json is perhaps the most convenient way to respond in 95% of cases.
The most important thing in REST is the structure of the API itself, which should be clean, descriptive and meet the "one action - one request" requirement mentioned above. That is, a structure of the form
/user/1/delete
/user/create
/user/1/getinfo
RESTful is something that complies with the restrictions of REST, no one obliges you to use HTTP, some URL formats, HTTP methods, json or XML. You can even send messages on carrier pigeons in the Russian obscene format, and make a RESTful API based on them
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question