Reputation: 16079
So I know this is crazy from a security standpoint, but let's say I have a posts
resource at /posts/
and I'd like an admin to be able to trigger a transformation on the collection (in this case, a simple data migration).
How should I design the URL for something like that? It's basically a remote procedure: "take all the posts, modify them, and save them", which is why it is hard to shoehorn onto REST.
Upvotes: 2
Views: 551
Reputation: 16079
I ended up just doing POST /posts/name-of-transform
. It's going to be hacky either way :(
Upvotes: 2
Reputation: 197
So what you want is to update a collection right?
I think what you're looking for is the http PATCH method. It will acte pretty much like your POST method but instead of creating the ressources it will update them.
You can find more about the PATCH method at this address : https://restful-api-design.readthedocs.org/en/latest/methods.html
Upvotes: 0