Punter Vicky
Punter Vicky

Reputation: 17032

REST API URL naming convention

I would like to check if an order is active with retrieving the order details. I have an enpoint designed similar to what is listed below

/order/{order-id}

However I was to check if the order is active without retreiving the details of the order. Which of the below is a better approach to do this or are there any other alernatives?

/order/{order-id}/is-active

or

/order/is-active/{order-id}

Upvotes: 0

Views: 401

Answers (1)

rgs258
rgs258

Reputation: 105

Django Rest Framework, a widely used REST API framework, uses the second form /order/{order-id}/is-active.

See Routing for extra actions and Reversing action URLs for examples of this in their documentation.

Upvotes: 1

Related Questions