A REST API can have parameters in at least two ways:
- As part of the URL-path (i.e.
/api/resource/parametervalue
) - As a query argument (i.e.
/api/resource?parameter=value
)
What is the best practice here? Are there any general guidelines when to use 1 and when to use 2?
Real world example: Twitter uses query parameters for specifying intervals. (http://api.twitter.com/1/statuses/home_timeline.json?since_id=12345&max_id=54321
)
Would it be considered better design to put these parameters in the URL path?