Advice for Unique Index REST URI
Can you advise me on what URI you would use to expose the following via REST?
For example, table ItemVendor is a linking table between tables Item and Vendor (one to many) and has a Unique Index on columns ItemID and VendorID. Suppose this table also has some additional information which relates to this specific combination.
This seems unclear:
/ItemVendors/开发者_如何学JAVA{ItemID}/{VendorID}
Would you do (also weird to me):
/ItemVendors/Item/{ItemID}/Vendor/{VendorID}
I think the most clear way to state this is:
/ItemVendors?ItemID=x&VendorID=y
But none of my other end points use a querystring so far.
Suggestions?
Thanks!
Another option can be to use a separator char and combine your both keys into one variable.
/ItemVendors/{ItemID~VendorID}
I decided to handle this using query-string parameters. Just having the "&" between the parameters, to me, indicates the intent clearly that you want to filter object based on all provided parameters. Of course this won't be the case for all methods but for now, it works.
精彩评论