ollebil
(Olof)
January 22, 2020, 7:59am
1
I'm trying to monitor an API that is behind Azure API management using heartbeat, and I need to submit the API key.
This works: "curl https://api.blabla.com/service/v1/product/apicall " -H "Ocp-Apim-Subscription-Key: 1234567890" -i -s"
My heartbeat config is:
...
check.request:
method: "GET"
headers:
"'Ocp-Apim-Subscription-Key': '1234567890'"
...
but all i get is ""statusCode": 401, "message": "Access denied due to missing subscription key"
What am I missing?
If you look at the headers section: https://www.elastic.co/guide/en/beats/heartbeat/current/configuration-heartbeat-options.html you will notice that it isnt wrapped in double quotes.
I think you would just want to put 'Ocp-Apim-Subscription-Key': '12345'
on the line after the other header.
It looks like:
- type: http
schedule: '@every 5s'
urls: ["http://localhost:8080/demo/add"]
check.request:
method: POST
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Ocp-Apim-Subscription-Key': '12345' # Maybe?
# urlencode the body:
body: "name=first&email=someemail%40someemailprovider.com"
check.response:
status: 200
body:
- Saved
- saved
system
(system)
Closed
February 20, 2020, 2:47pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.