Need help with naming



I have 1 resource order with 2 very different creation strategies.

How can I name these urls?


post /orders/?type=cart
post /orders/?type=product

but cart and product - 2 very very different strategies ?


post /orders-create/cart/
post /orders-create/product/

I don’t know


post /orders-create-cart/
post /orders-create-product/


Hi, I’m no expert but I would go with the first variant, with the ?type param.

Because in my opinion is more jsonapi-style:

main urls
GET /orders
POST /orders ?type=cart | product
PUT /orders/1
DELETE /orders

with the other two versions you would change that structure.
You can validate the “type” whether its card or product and proceed :slight_smile:



Be careful, the type query parameter is not part of the specification.

Try this:

GET /orders
GET /cart-orders
POST /cart-orders
GET /product-orders
POST /product-orders

(I’ll let you figure out the other ones, whatever works best for you)

The idea is that you can have two types if they are that different. But you can have ordersto cover all the types. You can POST and GET any type, but you can only GET orders.

To give you a better answer, I’d have to know more about what you mean by different strategies.