everyone =)
I'm kind of novice in rest services, so I'm not sure if some features are possible.
For instance I have a list of items and many ways to filter those before delevering to a client app.
I'm using .net
, linq
& wcf
rest service with json
return format.
Ways to filter the list:
.../Items/RecentOnes
.../Items/FilteredByDate
.../Items/ItemsWithCrashID('CrashId')
.../Items/ItemsWithValue('Value')
etc. And I need those filters to be called in one query. Like
.../Items/ItemsWithValue('Value')/RecentOnes/FilteredByDate
or
.../Items/FilteredByDate/ItemsWithCrashID('CrashID')/Recent
and other 14 possible combinations. (As you see, the order of the filters shouldn't matter)
My question is - Is it possible to write those 4 services somehow, to make all those combinations work?
Or the only way to do so is to write a single service with 4 params, like
.../Items?recentOnes=true&FIlteredByDate=false&CrashID=&Value=somevalue ?
Thanks in advance =)
Nice question! As restful web services used url as resources representation, e.g:
so you can see that you url:
It's not represented to any specific resource at all. It seems like you are looking for some items, which is filtered by value. It's like a search. So your second choice is better, use any thing you want to filter as query string.