rest - What is the proper HTTP method for modifying a subordinate of the named resource? -


I am creating a web client in which they are recorded to modify a set of database tables and record them Adding and removing them. It should be done so atomically, so both removal and insertion should be done with a single HTTP request. Obviously, this is some kind of writing work, but I struggle to find out which method is appropriate.

Posts already seemed right, except that a post request "a new subordinate of nominated resource" is not enough that what I am doing here.

PUT can be used to make changes to existing things, so even though the correct "URI recognizes the unit attached to a PUT request request." .] And the server should not attempt to apply the request to any other resource, "who make rules for that method because my URI does not directly specify database tables.

URI revises the resources specified in, no subordinate resources

So what method should I use?

Or to more commonly benefit from other users:

  • For a request for X, you
    • To create a new subdivision of X
    • To create a new X
    • To modify X.

      But if you want to modify the subordinate of X, what method should you use?

      To start .. Everything else is is REST. If the rest is your hammer, then everything can look like a nail.

      If you really want to be consistent with the other ideals, then patch is out of the question. You really want to move the state.

      A common solution to this problem is' You have to work out of resources already, but invent a new resource that you want to represent 'Transactions' to perform. This transaction can contain information about the sequence, which is probably atomic.

      This will give you the PUT (or the POST ) transaction, and obtain the transaction if necessary The current situation is to find out if it was successful.

      In most designs this is not really good, and you just come back to POST and define the original RPC-style action you do on your parents Are there.

  • Comments

    Popular posts from this blog

    php - PDO bindParam() fatal error -

    logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

    java - Why my included JSP file won't get processed correctly? -