D
D
DiaTMss2019-07-05 14:08:08
RESTful API
DiaTMss, 2019-07-05 14:08:08

What is REST for?

Good day dear programmers. What is REST for?
Let's say on my server php can process GET, POST and everything seems to be fine. Well, why PUT, PATCH, DELETE, OPTIONS for the organization of the CRUD type, as in databases such as mysql INSERT, DELETE, UPDATE, SELECT. Does REST affect the performance of request processing if it is split or is it for ease of use of the api?

$router->get($uri, $callback);
   $router->post($uri, $callback);
   $router->put($uri, $callback);
   $router->patch($uri, $callback);
   $router->delete($uri, $callback);
   $router->options($uri, $callback);

https://habr.com/ru/post/265845/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2019-07-05
@DiaTMss

It's just a standard, one of many. First of all, it is needed so that people understand each other as accurately as possible, as with all other contracts.
In the concept of REST:
POST is only for creating resources
PUT is for overwriting resources
DELETE is for deleting resources
and OPTIONS is just an HTTP specification and it's for preflight requests to find out if a client can perform a
REST operation does not affect performance in any way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question