RAML - how to design endpoints with parameters?

96 views Asked by At

I have a requirement to design this spec using RAML:

Resource: quantity

Method: GET

URL: {orderId}/{itemId}/quantity

Objective is to pass orderId and itemId in the URI and get quantity. I am designing it this way:

/{orderId}/{itemId}/quantity:
  get:

Is it a best practice to design resource this way or there have a better way?

1

There are 1 answers

0
AudioBubble On

Something like this will be a bit more RESTful by providing the relationship between your orders and items as collections and individual data:

/orders:
  /{order_id}:
    /items:
      /{item_id}:
        get:

quantity should be a field in the response body.