Azure Api Management: How to count amount of requests without Subscription Header

Viewed 613

My users using AAM API endpoint for a third-party service that requires a webhook - and I need to show usage of this endpoint in User Reports

Third-party API does not support headers and I can't pass Ocp-Apim-Subscription-Key user subscription key to it, and the request will be called anonymously. As far as I understand that will not allow counting that request in User Reports.

Endpoint settings

But I can use a token URI parameter to manually get subscription-id and keys for it, with send-request policy. If I do this is there a way to add the Ocp-Apim-Subscription-Key header to (running?) request in order to perform it on behalf of user subscription?

So far, I can only think about wrapping the required request in another AAM request which will use send-request and set-header policies like that

> POST /endpoint/telegram/public/token123
>> <send-request>GET /token123/keys/primary</send-request>
> POST /endpoint/telegram/token123 +H 'Ocp-Apim-Subscription-Key:key123'
2 Answers

I returned to this question after a couple of days and feel extremely embarrassing now.

To perform a request on behalf of the User I can use the API key in the query instead of the header, there are literally separate setting for that enter image description here

That solves everything.

Related