Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is probably not a single correct answer to the question in practice, since there are so many different URL schemes in usage out in "the wild". However a helpful way to look at it would be in terms of REST URL processing. In REST (REpresentational State Transfer), the idea is to be able to uniquely identify every resource that you want to provide access to. In a common REST scheme, the path portion of the URL could be thought of as a set of coordinates in N-space (i.e., x, y, z => //myApp/x/y/z) and the query parameters are further specifiers. These further specifiers could be used as search criteria for incomplete path specifications, to return a list of matching resources.</p> <p>See the <a href="https://stackoverflow.com/q/4024271/433348">following question</a> for more examples of REST URLs.</p> <p><strong>EDIT:</strong> @marcok has a good technical answer, but as your updated comment exposed, you seem more interested in when to choose one over the other. Generally if you are going to be creating "pure" RESTful API, anything that is part of the path should uniquely identify resources by their identity. Oftentimes, this might have your URL ending in an ID value as part of the path to uniquely identify a resource.</p> <p>However, if your API is directly exposing the ability to search/filter by attributes (probably excluding IDs), you would be more likely to encode that as a query parameter.</p> <p>These are just examples, and there are different opinions of what entails a good API, and more specifically how purely-RESTful an API needs to be.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload