0
votes

I'm trying to create a request with parameters in Azure API Management.

I have the following API(returns all invoices):

www.apibackend.com/invoice

This API can also handle parameters like this(returns invoice with ID 1):

www.apibackend.com/invoice/1

In my APIM service I've got the following code:

<policies>
<inbound>
    <base />
    <set-backend-service base-url="www.apibackend.com/" />
    <rewrite-uri template="/invoice" />
</inbound>
<backend>
    <base />
</backend>
<outbound>
    <base />
</outbound>
<on-error>
    <base />
</on-error>

With the APIM URL(for example: www.apim.com/test/GetInvoices) I can make the following request to my backend:

www.apibackend.com/invoice

This will return all the invoices, but how do I only retrieve the invoice with ID 1? If i make the request "www.apim.com/test/GetInvoices/1" I will get an error.

Hope someone can help!

1
I'm not sure what the actual question is. how to pass in query string to the backend api?4c74356b41
I want to send a parameter with the front-end string of Azure API Management to my back-end API.NielsStenden
well, depends on how you get it? calculate it and send it over4c74356b41

1 Answers

0
votes

In APIM change your Operation template to GetInvoices/{id} then in policies you'll be able to do:

<rewrite-uri template="/invoice/{id}" />