rest - What is the best RESTful uri for a resource's tags -


say have resource of recipes , recipe can have tags. want list of tags used across recipes, uri be?

/recipes/tags 

seems might work breaks convention of not pointing specific id such as:

/recipes/1/tags 

you use:

/tags 

but want tags recipes not other resource. use query params, such as:

/tags?type-recipes 

and ftr, tags used recipes not other resource, seems misleading use query param since never recipes

filters tricky -- when filter resource.

you correct /recipes/tags problematic. go path variable of /resouce/{resouceid} /resource/{filter} can open whole word of pain.

so first example go

 /recipes?tags={tags filter on}  returns list of recipes based on tag 

the problem don't have lookup method acceptable tags are. expect /tags return list of tags , consume this

 /tags  returns list of tags   /tags/{tagid}  returns meta data specific tag (what tag used for, superfluous in case if have recipe tags, more flexible)   /tags/{tagid}/recipes  returns list of recipes associated id. 

then have decide if want support linked resource this

 /tags/eggs/recipes/1  recipe details  

which still same thing

/recipes/1  

it's acceptable link them -- might confusing if recipe/2 doesn't have eggs in , try access using /tags/eggs/recipes/2


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -