W
W
wideShift2021-10-21 14:50:01
RESTful API
wideShift, 2021-10-21 14:50:01

Is it necessary to use something other than GET, POST when building a REST API?

I didn't see it in the architecture requirements. I think many things can be interpreted in different ways.
How will a regular API written in, say, PHP (GET, POST) and returning json differ from REST?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2021-10-22
@nofail

HTTP methods are used because they are well suited for interacting with resources and are documented. You don't have to guess what GET does, it's described in the rfc. That is, there are no situations "So ... I need to get a resource with such and such an id, what should I do - send GET? POST? DELETE?"
If your application meets Fielding's requirements

  1. Client-Server
  2. The server should not store the state of the client
  3. caching
  4. Single interface between components
  5. Resource identification
  6. Manipulating Resources Through Views
  7. Self-descriptive messages
  8. HATEOAS (hypermedia as the engine of application state)
  9. Layered architecture
  10. Code on request (Optional)

then it will be REST, even if you don't use HTTP at all, and instead you exchange memos via hollows.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question