0

I create a restful DELETE service, for example, the URL is

http://localhost/book/10, 

use DELETE method to send this request, but I need to record this operation by which user, so I need to send an operatorId parameter with that DELETE method request. How to build this delete url?

http://localhost/book/10?operatorId=10

or

http://localhost/book/10/operator-id/10

or other url.

Can you help me?

Liu guanghua
  • 981
  • 1
  • 9
  • 18
  • Hi @Liu, Can you clarify what you need help with? Is it which format to use, how to build it the url, or if this is even a good idea (it's not). – C. Ross Aug 27 '12 at 18:29

1 Answers1

0

Well, you don't want just anyone deleting, so you can just check the cookie or basic auth credentials sent along with the request.

Plus, a RESTful DELETE is supposed to be idempotent, meaning that nothing changes when the same call is made. If you're mucking with the database, it's no longer a valid contract between the client and the server.

Josh
  • 12,448
  • 10
  • 74
  • 118