The cleanest RESTful design for pure "calls"?

I put my sock in the RESTful waters, and I just can't find a “satisfactory” solution, how to handle truly “action-oriented” calls in the RESTful service? My quandry can be broken into two parts.

1) Transactional calls: I understand the idea of ​​having an ActionTransactor, that you get a resource with a message, update the parameters and then do it using PUT (as described everywhere and in the Orilly RESTful web services book) .. But I'm struggling with the idea of ​​saving URLs with states present forever. If we really honestly do not need to save the transaction forever, can we kill the resource URI? URIs must be permanent or may be transitive URIs that expire

2) Non-transactional calls: these may be calls to execute some workflow that spans multiple resources, but is simply not created with any resource. An example might be to regenerate some computed ans caching value, such as a large aggreget or reindexing a blog or some such "pure" action.

In any case, I’m interested in learning about these communities ... Until now, I read that Overloading Post is the cleanest way to handle Part 2. But there are an equal number of arguments against this approach, since Well. And (for me) its not self-sufficient documentation, which I, however, was one of the key goals of RESTful API design.

+3
source share
1 answer

1). Maintaining stateful URIs: Browse any website. He has several pages. Some are deleted, and we get 404 when we try to access them. Consider a database of clients, for example. Our RESTful accessory has URIs such as http: // myserver / customer / 12345 - if the client was blocked, we can return 404. In my opinion, this is quite reasonable. URIs are transitory in that they can be syntactically valid, but the system has well-defined behavior if the resource is now deprecated. I believe that error handling for services served is an important factor. I discuss this one here

2). , , , REST: , PUT POST . , -? , PUT/POST

http://myserver/request/cacheupdate

, ( , , ). , , .

http://myserver/request/12345

.

+1

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


All Articles