Hi, we have a resource
credit-card-payments and another resource
wire-transfer-payments. We want them to be accessible through a general
POST /payments PATCH /payments/:id GET /payments GET /payments/:id
When creating or updating the resources, we specify the
type so the server knows which resource (
credit-card-payments) is dealing with. Also, when fetching all the payments, we get a mixed list of
credit-card-payments, so there’s no problem there either.
The problem comes when fetching a specific
payments resource. Where the
type of the resource (
wire-transfer-payments or a
credit-card-payments) be passed so the server can handle it?
We thought of using a query-param like
GET /payments/:id?type='credit-card-payments' but it doesn’t feel like the best approach.
What would you recommend?