Reputation: 16450
What HTTP method should I use if I want to query a collection for the given IDs that possibly go over 500 items. Like:
GET /api/v2.0/collection/?ids=1,2,3,4,5,6...
Query param is not gonna look good with over 500 items. and GET
doesn't have a Content-Size. POST
seems not a good fit since I'm just fetching the resources selectively. What would you great programmers do? Do you know any public example I can check?
Upvotes: 0
Views: 107
Reputation: 23436
One way to deal with a situation like this is to make the ids collection into their own resource.
For example, you can create a selector resource to which you can POST
the ids like:
POST /api/v2.0/selectors
[1,2,3,4,5,6,...]
The POST
request would return a selector <id>
, which you can use to query the collection resource like:
GET /api/v2.0/collections?selector=<id>
Upvotes: 2