# Heartbeat Use json with secret store in check.request.body

**URL:** <https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869>\
**Category:** Beats\
**Tags:** heartbeat\
**Created:** [September 8, 2020, 10:13am UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869 "2020-09-08T10:13:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pawarrchetan](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pawarrchetan](https://discuss.elastic.co/u/pawarrchetan)\
**Post date:** [September 8, 2020, 10:13am UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869/1 "2020-09-08T10:13:05Z")

</div>

I need help to figure out the correct json payload for my http monitor to test an authenticated endpoint.  
Monitor YAML :

```auto
  name: test-xyz-abc-io
  enabled: true
  schedule: '@every 1m' # every 10 minutes from start of beat
  hosts: ["https://xyz.abc.io/v1/uri"]
  ipv4: true
  ipv6: true
  mode: any
  check.request:
    method: POST
    headers:
      'Content-Type': 'application/json'
    body: "{"org_id": "0", "email": "user@gmail.com", "password": "${USER_PASSWORD}"}"
  check.response:
    status: 200
  fields:
    env: test

```

I get an error in the heartbeat logs :  
`cfgfile/list.go:96 Error creating runner from config: job err can not convert 'object' into 'string'`

---

<div class="post-metadata">

**Author:** ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)\
**Post date:** [September 9, 2020, 10:38am UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869/2 "2020-09-09T10:38:53Z")

</div>

Hi @pawarrchetan  
if you format your body json like this, it should work

```
  body: '{"org_id": "0", "email": "user@gmail.com", "password": "USER_PASSWORD"}'

```

Regards

---

<div class="post-metadata">

**Author:** ![pawarrchetan](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pawarrchetan](https://discuss.elastic.co/u/pawarrchetan)\
**Post date:** [September 9, 2020, 10:57am UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869/3 "2020-09-09T10:57:41Z")

</div>

Hello @shahzad31  
Thanks for the suggestion.

For me the USER\_PASSWORD is a secret from the heartbeat keystore.  
Will it work if I specify it as suggested by you ?

Regards...  
Chetan

---

<div class="post-metadata">

**Author:** ![pawarrchetan](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@pawarrchetan](https://discuss.elastic.co/u/pawarrchetan)\
**Post date:** [September 9, 2020, 11:24am UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869/4 "2020-09-09T11:24:46Z")

</div>

Hi @shahzad31  
I get password attempts exceeded in the elaticsearch events after I have the correct secret value in the keystore .

```auto
{"message":"Password attempts exceeded"}

```

Mentioning the key name `"USER_PASSWORD"` just uses the password value as literal `"USER_PASSWORD"`

So the suggestion you made does not work.

Are you sure if we use the heartbeat keystore secret key as `USER_PASSWORD` in the monitor configuration heartbeat would interpolate the value correctly ?

```auto
  body: '{"org_id": "0", "email": "user@gmail.com", "password": "USER_PASSWORD"}'

```

Regards...  
Chetan

---

<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:** [October 7, 2020, 1:24pm UTC](https://discuss.elastic.co/t/heartbeat-use-json-with-secret-store-in-check-request-body/247869/5 "2020-10-07T13:24:47Z")

</div>

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