When do I use path params vs. query params in a RESTful API?

I want to make my RESTful API very predictable. What is the best practice for deciding when to make a segmentation of data using the URI rather than by using query params.

It makes sense to me that system parameters that support pagination, sorting, and grouping be after the ‘?’ But what about fields like ‘status’ and ‘region’ or other attributes that segment your collection? If those are to be query params as well, what is the rule of thumb on knowing when to use path params?

8 Answers
8

Leave a Comment