0
votes

I have written a simple raml which can either GET all customers, GET a customer by Id or GET customers by Name. The RAML has the following structure:

/customer
   get:
      ...
   /{id}
      get:
         ...
   /{name}
      get:
         ...

My problem is that when I pass in a customer name e.g. john then it keeps falling into the processing for GET {id} and when I have looked at the request URI it shows /api/customer/john so it looks like it falls into the GET {id} processing because it can't differentiate which URI parameter it is for and GET {id} is the first flow in the XML.

How can I prevent this and get it to go to GET {name}?

I am calling this from the Anypoint API console and using Mule 4.1 and Anypoint 7.

Thanks

1

1 Answers

1
votes

URL params are just strings. So raml and apikit have no way to differentiate the the two. They have no way of knowing what is a ‘name’ vs ‘id’.

I would change it to have customer/{id} and use a query Param on the customer resource ?name=John instead