Let’s say I have a resource that can have two different behaviors when delete is called
- The resource is deleted.
- The resource is moved to the recycle bin.
How would model it in a REST compliant way?
I thought about the following solution:
DELETE /myresource
moves the resource to the recycle bin (default behavior)
DELETE /myresource?force-delete=true
forces delete on the resource.
Is that REST compliant? I have never seen query parameters in the URL when calling DELETE, is that OK?
A pure REST strategy should prefer non changing resources. In my opinion, you are not changing the resource by appending a parameter, so it sounds like good strategy to me.
If you were to perform the same action like so:
that would act like another resource, which wouldn’t be optimal.