What is the correct way to do a get for multiple resources (batch get) with REST?

Viewed 8203

Is it:

GET api/stuff?ids[]=123&ids[]=456&ids[]=789&ids[]=101112&etc...

is it:

POST api/stuff/batch
  body: ids: [123, 456, 789, 101112, etc]

?

The first seems semantically correct, but aside from having an incredibly gross url, there are sources that say there's potentially a limit for the length of a get, so what if I have a gazillion ids?

The second seems better because there's no gross url, but my understanding with rest is that a POST is supposed to be making a change, not be idempotent..

So is this purely a semantic issue and there's no true "correct" way?

3 Answers
Related