In Azure API Management can i use the subscription-key as part of Request headers instead of Query string parameter?
Asked Answered
P

2

14

I am migrating a service to Azure API Management. This service is being called from mobile devices (native apps). Problem is that appending the subscription-key to the query string can take much longer for updating the app than just using it in the request headers.

So is it possible to use it there?

Panta answered 24/7, 2014 at 13:14 Comment(0)
P
32

The subscription key can be passed either in the header or in the URL query parameter. The header is checked first. The query parameter is checked only if the header is not present. The header name is Ocp-Apim-Subscription-Key by default though you can change it; the same holds for the query parameter whose default name is subscription-key.

Poundfoolish answered 24/7, 2014 at 17:18 Comment(3)
sorry. my bad. I confused "Azure API Managment" with "Azure Management API" .... But it would be really helpful to provide link to documentation when answering question. For instance how would the next developer find out this header? Where is it documented?Cool
Setting the header to oco-apim-subscription-key and giving it the subscription key value that would be appended to the query string worked for me. I used DHC app for Chrome. Thank you.Panta
it seems there is a bug on apim developer portal, when I use Query parameter(default value should be subscription-key), the call ends up with 401, message: "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription" , however, if use rest client, it works well.Capitalistic
H
9

As an Add-on to @vladvino post. This is configurable per API. It is available in the Setting pane of the API Settings in the Azure APIM Portal.

enter image description here

Heteroplasty answered 19/3, 2019 at 21:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.