13

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?

ConfusedNoob
  • 9,826
  • 14
  • 64
  • 85
alinulms
  • 509
  • 1
  • 4
  • 19

2 Answers2

30

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
vladvino
  • 610
  • 5
  • 9
  • 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? – astaykov Jul 24 '14 at 18:08
  • 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. – alinulms Jul 28 '14 at 12:07
  • 1
    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. – Kevin Xiong May 10 '19 at 15:22
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

Glenn Ferrie
  • 10,290
  • 3
  • 42
  • 73