I have a resource (project
) which can be activated and deactivated.
What's the most RESTful URL endpoint for this purpose?
Right now I'm thinking about /projects/:id/activate
and /projects/:id/deactivate
, but I don't think that's very RESTful.
In addition, I'm not certain what HTTP method to use.
Can you provide some pointers?
Thanks!
The default URL to access the messaging REST API is: https://localhost:9443/ibmmq/rest/v1/messaging . If the host or port is changed from the default, or if HTTP is enabled, you can determine the URL by using the dspmqweb command.
A RESTful web service request contains: An Endpoint URL. An application implementing a RESTful API will define one or more URL endpoints with a domain, port, path, and/or query string — for example, https://mydomain/user/123?format=json . The HTTP method.
I know I am a bit late but maybe this might be useful for others.
You can create a noun from your operation and use it as sub-resource: activate -> activation
Now you can use POST
and DELETE
on this sub-resource.
For example:
POST /projects/:id/activation <-- activate project
DELETE /projects/:id/activation <-- deleting the activation = deactivate
This pattern can work quite well for operations that toggle between on/off state of something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With