asp.net - Nested REST Routing -


simple situation: have server thousands of pictures on it. want create restful business layer allow me add tags (categories) each picture. that's simple. want lists of pictures match single tag. that's simple too. want create method accepts list of tags , return pictures match these tags. that's bit more complex, can still that.
problem this, however. say, rest service @ pictures.example.com, want able make following calls:

  • pictures.example.com/image/{id} - should return specific image
  • pictures.example.com/images - should return list of image ids.
  • pictures.example.com/images/{tag} - should return list of image ids tag.
  • pictures.example.com/images/{tag}/{tag} - should return list of image ids these tags.
  • pictures.example.com/images/{tag}/{tag}/{tag} - should return list of image ids these tags.
  • pictures.example.com/images/{tag}/{tag}/{tag}/{tag}/{tag} - should return list of image ids these tags.
  • etcetera...

so, how set restful web service projects allow me nest tags , still able read them all? without limitations number of tags, although url length limit. might want have 30 tags in selection , don't want set 30 different routing thingies work. want 1 routing thingie technically allow unlimited tags.

yes, know there other ways send such list , forth. better even, want know if possible. , if it's easy create. url cannot different above examples.
must simple, think. can't come solution...

the url structure choose should based on whatever easy implement web framework. expect like:

http://pictures.example.com/images?tags=tag1,tag2,tag3,tag4 

is going easier handle on server, , can see no advantage path segment approach having trouble with.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -