php - Hierarchy in Restful Url -


suppose there resource

  1. user - users registered

  2. book - books available in library

  3. favourite books - users favourite books.

what restful way construct url favourite books of user?.

i have confusion on hierarchy of resources in url. please me form correct urls.

the following urls comes mind when there request find out favourite books of user.

  1. users/:user_id/favourites/books

  2. users/:user_id/books/favourites

  3. users/:user_id/favourite_books

please me form correct way of constructing urls.

i think it's matter of personal preference.

is favourites important part of user , have more favorites movies example? i'd go one:

1. users/:user_id/favourites/books 

is 'property' of user's books , there more options, example last_read? i'd go one:

2. users/:user_id/books/favourites 

is 'property' of user , there more options, example age? i'd go one:

3. users/:user_id/favourite_books 

you might want ask question on programmers, think you'll more replies there.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -