REST APIs to demonstrate borrowed books and users from library

19 Views Asked by At

I have two resources Books and Users, quite simple. However I need to design or make APIs for the following requirements:

  • Find all users who at least have one book took out
  • Find still valid users who didn't have any book from the library
  • Users who took out a book on given date
  • All books that are taken by a given user on a given date
  • All books that are still available to be taken

I don't know which way to go now. Put books inside the user or user inside books, or just treat all of that as their separate distinct endpoints/resources.

It's quite a simple thing but I'm struggling to come up with a valid and good naming convention/strategy here with APIs. This is what I struggle with REST sometimes as compared to RPC calls. Is there any guide that provides pointers on what to do in such cases?

0

There are 0 best solutions below