3 ms·
To search use the search resource. Then you have, resource: "search results containing the word 'tuesday'"; url: /search?q=tuesday To approve you create a new
by daredevildave 16y ago
To search use the search resource. Then you have, resource: "search results containing the word 'tuesday'"; url: /search?q=tuesday
To approve you create a new approval resource:
POST to /approval with the id of the resource to approve. This creates a new resource at /approval/1
Then you can revoke the approval by DELETE /approval/1
- DougWebb 16y agoA search resource generally isn't going to be a good idea in a RESTful design. What does it search? Your service will typically contain more than just one set of resources, so you'd end up either creating a separate search resource for each set or passing set identifiers of some sort as a query parameter to the search resource. The typical model is to have 'container' resources. For example, if /articles/9001 is a resource, /articles is the container. You can POST to the container to create a new resource, and you can GET the container to find out some information about it, such as the number of resources it contains and a list of them. For this part of the design I'll typically return a list of links to the first N resources in the container and a navigation link to the next N resources. That navigation link uses the same URL for the container resource, but with a query parameter that tells it which resource to start on. I'll typically also implement search/filter query parameters to allow further control over the list of resources to include in the container's representation.