Monitoring Authorization Error

I have set up collection and added test to them. I added monitoring to a collection and it runs and passes one of the test that monitors how long the call takes, but it fails on the 200 status. I am getting a 401 unauthorized response. When I run the api it works and retrieves information, but when I run in monitor it fails? I have the Ocp-Apim-Subscription-Key set as a global variable, and it is correct in the api call.

Thank you for reachig out, please see if this helps

Accessible APIs

  • Monitors require all URLs to be publicly available on the internet as they run in the Postman cloud. A monitor cannot directly access your localhost or run requests behind a firewall. However, to overcome this issue, static IPs are available on Postman Business and Enterprise plans.

So make sure your API is authorized to be accessed from the outside world, see if this helps

Hi @jbalasi! I understand you are using a API key that is set as a global variable when running a monitor, correct?

Monitor does not have access to global variables so use collection/environment variables instead.

FYI, a few differences between runner and monitor:

  • All API must be publicly available
  • No access to global variables (use collection/environment variables instead)
  • No access to CURRENT VALUE (remember CURRENT VALUE is local to your session)

Hope this helps!

1 Like