# Monitor APIs using MetricsBeat

**URL:** https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386
**Category:** Beats
**Tags:** metricbeat
**Created:** [November 25, 2019, 9:55pm UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386 "2019-11-25T21:55:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![RunningSmurf](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@RunningSmurf](https://discuss.elastic.co/u/RunningSmurf)
#### Post date: [November 25, 2019, 9:55pm UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386/1 "2019-11-25T21:55:22Z")

</div>

Hello,

I would like to monitor an API call from ES and Kibana. The HTTP module in MetricBeat seems like the most logical choice. I have installed it, and I see that it is writing to ES. However, I am having issues configuring it. So far, I have this:

- module: http  
metricsets:
  - json  
period: 10s  
hosts: ["https://"]  
namespace: "json\_namespace"  
path: "/"  
#path: "/"  
ssl.verification\_mode: none  
#body: ""  
method: "GET"  
#username: "user"  
#password: "secret"  
request.enabled: true  
response.enabled: true  
#json.is\_array: false  
#dedot.enabled: false

However, I keep getting, in Kibana, the following error:  
"Authorization has been denied for this request"

I have tried adding the header for the API\_KEY and its value, but no luck. I confirm that from the ES server, the curl command with the API\_KEY and its value added as a header returns the query results. Would any know how I can add the header? I tried

header: "API\_KEY:"  
headers: "API\_KEY:"

and a bunch of variations... It seems to simply ignore the information. nay help would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![RunningSmurf](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@RunningSmurf](https://discuss.elastic.co/u/RunningSmurf)
#### Post date: [November 25, 2019, 9:57pm UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386/2 "2019-11-25T21:57:15Z")

</div>

A note for the entry above: not all of the values were accepted, so let me try the confirguation again:

module: http  
metricsets:

- json  
period: 10s  
hosts: ["[https://valueofserviceURL](https://valueofserviceURL)"]  
namespace: "json\_namespace"  
path: "/pathofAPI"  
#path: "/"  
ssl.verification\_mode: none  
#body: ""  
method: "GET"  
#username: "user"  
#password: "secret"  
request.enabled: true  
response.enabled: true  
#json.is\_array: false  
#dedot.enabled: false

I tried adding:  
header: "API\_KEY:value"  
headers: "API\_KEY:value"

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [November 27, 2019, 9:14am UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386/3 "2019-11-27T09:14:45Z")

</div>

Hi @RunningSmurf 🙂

I'd say that your headers format is not correct, check here [https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-ssl.html](https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-ssl.html)

It should be

```auto
headers:
  API_KEY: "value"

```

Best regards!

---

<div class="post-metadata">

### Author: ![RunningSmurf](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@RunningSmurf](https://discuss.elastic.co/u/RunningSmurf)
#### Post date: [November 27, 2019, 4:54pm UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386/4 "2019-11-27T16:54:23Z")

</div>

Thank you, this worked!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 25, 2019, 4:54pm UTC](https://discuss.elastic.co/t/monitor-apis-using-metricsbeat/209386/5 "2019-12-25T16:54:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
