I can retrieve one single book from Spring Data REST with a call such as: GET /book/{id}
Now, if I know the Ids of two books and I want to retrieve them all at once? What should the call be? I tried the following but it is returning me different books than the specified ones:
GET /book?ids=id1,id2
You could declare a query method in your Repository interface like this:
List<Book> findByIdIn(@Param("ids") Long[] ids);
So that you can request books this way:
GET /book/search/findByIdIn?ids=1,6,9