I have a resource called Pricing that I want to get. Offer can have a price, and Promo can have a Pricing resource and there is another Customer object with which Pricing can be matched. I want to get Pricing based on one of OfferId / PromoId / CustomerId .
To create the urls for this, I have two options:
Option 1: Pass it as a query string
/pricing?OfferId=234&PromoId=345&CustomerId=543234
Option 2: You have three APIs
/pricing/offer?id=234 /pricing/promo?id=345 /pricing/customer?id=543234
IMO, OfferId / PromoId / CustomerId should be considered as a resource attribute. Therefore, pass the attribute as a query string. I am more inclined to Option 1.
Option 2 avoids another condition for retrieving the resource and looks much cleaner, but does it seem to support the REST standard for URL design?
What is the REST standard for developing URLs. Which option would you recommend?
java rest
Pankaj
source share