In developing a RESTFul web service, I'm confused in modelling of my request entity. Should all the data required to process the request be a part of the entity or should I move some of the data in to the URL path (given that I've logical hierarchy among this data).
For example:
Path
/api/payment/3pResponse
Entity Schema
{
"marketplacedId" : String,
"customerId: String,
"contractId: String,
"planId": String,
"3pResonse" : {},
"3pResponseURI" : "string"
}
versus
Path
/api/payment/marketplaces/{mktId}/customers/{customerId}/contracts/{contractId}/plans/{plandId}/3pResponse
Entity Schema
{
"3pResonse" : {},
"3pResponseURI" : "string"
}
Please no that resources along the path such as the /api/payment/marketplaces/{mktId}
may not really exist in my application.
Either of the two would technically work, but I want to understand the best practices around entity modelling in such scenarios.