I faced this situation a lot in the last project. Since REST is good ... about a resource, it is not always clear how to deal with things that are truly RPC in nature.
An easy way to get around this is to think of it as a bureaucratic part of peace; the request may be the resource itself:
1. "Do you want to call the command on my server? First, fill out this form I90292 and send it to us":
POST /bureaucracy/command-request Content-Type: application/x-www-form-urlencoded Content-Length: ...
"Well, we'll see what we can do. Your case number is 999."
201 Created (or 202 adopted in accordance with Kugel’s comment) Location / bureaucracy / request team / 999
And then the client regularly checks
GET / bureaucracy / command-request / 999
I hope he gets an answer like the following
200 OK <command-request> <number>999</number> ... <result>Success</result> </command-request>
Of course, if the bureaucratic service will have great customer care, he will offer the client to call him when this is done, if he wants:
"Do you want to run the command on our server? Please fill out this form and send it to us. Please note that you can join your contact information so that we can call you when this is done."
POST /bureaucracy/command-request?callback=client.com/bureaucracy/inbox
Or as a custom X-Callback: http://client.com/bureaucracy/inbox http header X-Callback: http://client.com/bureaucracy/inbox
redben Apr 11 '11 at 18:09 2011-04-11 18:09
source share