API Standards

Not applicable

Hi,

I'm new to API development and I'm having some doubts about the standards that sould be maintained.

In my case, I'm defining an API that should have the following resource:

.../accounts/{accountid}/vouchers

by invoking this resource with a GET should return the list of vouchers for that specific account.

But I also need to invoke the API to checkout some of the previously returned vouchers.

My question is, should I have a GET operation with a resource .../accounts/{accountid}/vouchers/{voucherID} and have a query parameter like checkout=true which means it will only checkout one voucher at a time?

Is there a better way of doing this maintaining the recommended API standards if, for example, I need to checkout multiple vouchers?

Best regards,

Ernesto Costa.

Solved Solved
0 1 341
1 ACCEPTED SOLUTION

Hi Ernesto,

Ideally /accounts/{accountid}/vouchers/{voucherID} should always return a single resource, In case you need multiple resources from the collection as response, i think following would be a better approach

/accounts/{accountid}/vouchers?param1=value1 & param2-value2 , where param1 and param2 are you filter parameters.

View solution in original post

1 REPLY 1

Hi Ernesto,

Ideally /accounts/{accountid}/vouchers/{voucherID} should always return a single resource, In case you need multiple resources from the collection as response, i think following would be a better approach

/accounts/{accountid}/vouchers?param1=value1 & param2-value2 , where param1 and param2 are you filter parameters.