I am currently designing a API and have come to a slight design issue and was hoping for a few other opinions. My url structure for accessing basic data from the API is: /clientName/appName/methodName/. Basically each client may have a different set of methods for each application, so the base application class is extended through each client if the file exists. My question is with limiting the data pulled back through a GET request. Should the limiting number be appended to the URL or is that something that should be handled through POST request only? Should it even be a option? Looking for best practices in this scenario, thanks.
Tell me more
×
Programmers Stack Exchange is a question and answer site for
professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
|
|
The URI ending in "10" representing maximum returned rows is not a resource. Your number "10" is scope. Scope belongs on the query like so: /clientName/appName/methodName?maxrows=10 Furthermore, you wouldn't pull back data on a POST request. You're POST'ing data to the web server, you're not asking to GET. I'd also question having "methodName" in the URI, this smells of RPC over a GET request. This is not how URI's should be designed. I see that as someone being tempted to do a HTTP GET '/clientName/appName/saveData'. Think of your application as resources: /clientName/appName/products?like=foo /clientName/appName/items?maxrows=10 /clientName/appName/items/keyboards/msnatural |
|||||||
|