This is normal. if our RESTful web service does not support XML?

Our web service only supports JSON. We respond to JSON if we can or respond with an HTTP 406 error: not acceptable if the client requests the application / xml ... Is it still considered RESTful?

+3
source share
5 answers

Yes. REST principles are based on the original intent of the HTTP protocol. There is no requirement to use XML. In fact, XML did not even exist when HTTP was created ...

+8
source

xml, . , API , .

+1

REST XML.

.

HTML.

+1

RESTful. .

. XML-, . , XML.

RESTful API, JSON, XML.

0

, : , RESTful? API , , , .

-, REST , . REST HTTP , API HTTP- -, URL- -.

:

  • GET/foo < - GET -.
  • POST/foo < - POST
  • PUT/foo/bar < - PUT . , URL-, , URL-.
  • DELETE / foo / bar <- should be obvious

For example, if your API had a single URL endpoint, and the method was chosen by what is inside the POST data, then this is probably not RESTful. On the other hand, if each URL was a resource, and the API was used to move the URLs, and that something that changed something used POST / PUT and everything that requested something used by GET, this is what most would consider RESTful.

-1
source

Source: https://habr.com/ru/post/1764227/


All Articles