
Given an object structure similar to this, how does one structure the API? Does the header, BookWishlists, have its own endpoint and the details, the WishlistEntries, are fetched seperately?
Also, how should the API be structure for the various types of WishlistEntries? Do we have one endpoint that accepts the “type” of entry to add?(POST /[EntryType]/[BaseBookId] as an example) Is it better to have a distinct endpoint for each type of entry?(POST /BookOnAmazon/[BookOnAmazon:Id])
A link to an api that does something like this would be appreciated as we’ve been unable to find one.
We’re doing this in ASP.net Web API with a Phonegap/Javascript frontend if it’s relevant.
Each “resource” is An endpoint, and I think your URL structure for the wishlists looks fine.
I don’t think mapping database tables directly to resources is always the right thing to do. You would be better off putting yourself in the mindset of the consumer of your API. What will they need to ask for?
It looks to me like you only have 2 resources
With book being something that is actually part of a wishlist. You may or may not want to return all the book details with a wishlist entry, or perhaps just and ID which the consumer can then request. The latter would require more development effort/requests by the consumer, but will probably be more efficient.