I saw many examples of how to structure the URL for basic CRUD operations, but I saw very little when I talked about more command operations or application service calls.
For example, let's say in my application service I have a call of type RemoveOldOrders (int customerId) that will remove any order from the system older than 2 years for the client with the identifier "customerId". What would the url look like in my calm service? What will be the payload of the call? What HTTP method (POST?) To use?
My thought: it will be something like this:
/ Customer / 1 / RemoveOldOrders as a POST, with an empty body (since the client identifier will come from the URL).
Are there any good recommendations on this?
Update: I feel that I need to clarify my question a bit instead of commenting on a possible duplicate post (yes, this post asks almost the same thing, but I really don't feel that the question was answered well).
What if I want to perform an operation against a resource, but this operation does not fit into standard HTTP verbs?
Another example: is my application connected to an ESB, and should there be a way to force the projection of my resource on the ESB to be processed? In my current SOAP-based web service, I would have a method like:
ExportCustomer(int customerId)
Now, in the case of a RESTful service, how can I represent this action in uri? Option 1 from Brian Kelly's answer seems the most logical, something like:
POST http://someapp/api/customer/1/export
or will be:
POST http://someapi/api/customer/export/1
it's better?