asp.net web api - Rest API design multiple URLs to same resource? -


in api have following resource:

example.com/api/v1/users/me/sites example.com/api/v1/users/123/sites 

which returns sites current or given user.

now, if want fetch sites, , ignore users. i'd assume have following url:

example.com/api/v1/sites 

which strikes me odd have sites root resource , subresource users.

is ok approach or common other way?

or should like:

example.com/api/v1/users/sites 

where there no id users?

there no problem having

example.com/api/v1/sites 

in addtion

example.com/api/v1/users 

especially each seems root aggregate.

so if association composition rather aggregation (between site , user) not ok, correct have them root url fragment.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -