# How to do a POST event in Synthetic Browser monitoring?

**URL:** <https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949>\
**Category:** Synthetic Monitoring\
**Tags:** synthetic-monitoring\
**Created:** [July 31, 2020, 6:48pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949 "2020-07-31T18:48:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 31, 2020, 6:48pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/1 "2020-07-31T18:48:37Z")

</div>

I’m trying to do a simple synthetic browser monitoring script, that does a POST request with some data. I have been struggling for more than an hour to find how to do such basic functionality, but seems it’s better to seek some help here… Any clue?

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [July 31, 2020, 6:55pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/2 "2020-07-31T18:55:34Z")

</div>

@Antonio S. i was just able to create a synthetic monitor click path that goes to the Dynatrace Config API and creates a managment zone, and then deletes it. Where are you running into a snag?

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 31, 2020, 9:14pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/3 "2020-07-31T21:14:24Z")

</div>

It must be because it’s late Friday night here 😉

I have looked at the available browser clickpath events,

> **[Browser clickpath events in Classic](https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring/browser-monitors/browser-clickpath-events)**
>
> Learn about the event types created when recording a browser clickpath.

but there seems to be no way of making a POST, namely with the “navigate” event.

It does seem to be possible to do it with the HTTP monitors, but not  
with the browser monitors, which was the one I referenced…

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [August 3, 2020, 1:02pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/4 "2020-08-03T13:02:16Z")

</div>

[@Chad T.,](https://answers.dynatrace.com/users/36422/view.html)

Can you confirm please what type of synthetic monitor you used? Just to be sure it was not the browser clickpath?

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [August 3, 2020, 1:05pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/5 "2020-08-03T13:05:50Z")

</div>

How are you doing this? I’ve seen it work in Browser Clickpaths using fetch.

The first event has to be a Navigate in Clickpaths though, so you can only do this as a later event.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 3, 2020, 1:10pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/6 "2020-08-03T13:10:52Z")

</div>

I did use the click path to do the post - I did not run into any issues with that - I dont think you can do it via the basic browser monitor as how would you input the Json payload.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [August 3, 2020, 2:33pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/7 "2020-08-03T14:33:00Z")

</div>

Not sure what “fetch” you are referring to?

Yes, the Navigate is the first. After that I have the following options:

 ![25962-1596464600805.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/56ac3977de8531a00ae7363b723874a88df5b986.png)

Navigate seems the only option that could support a POST, but it is very limited in what we can do:

 ![25926-1596464737140.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/c980ca7a9825e8f544cc7a7492ccffd70d64ab50.png)

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 3, 2020, 2:40pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/8 "2020-08-03T14:40:04Z")

</div>

Why are you adding it manually? its much easier if you add the chrome extension, then record your click path via the new browser window and access your www.\<ApiEndPoint\>.com and post the json payload.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [August 3, 2020, 2:51pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/9 "2020-08-03T14:51:29Z")

</div>

Yes, I normally use the Chrome extension, but in this specific case, it can’t be done 😞

Now I understand how you did it 🙂

BTW, this is not a POST to an API. It is a specific POST in a login situation…

I’ll probably have to go the Javascript route…

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 3, 2020, 2:54pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/10 "2020-08-03T14:54:37Z")

</div>

ahh okay, id be interested if you can still be able to get it working via the click path set up - keep us in the loop how it goes.! you can always also create the Synthetic via in a Json then pass it into Dynatrace and have it create it.

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [August 3, 2020, 2:55pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/11 "2020-08-03T14:55:17Z")

</div>

Apologies, I should have mentioned that it’s a ‘fetch’ in JavaScript event that is required to do this.

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [August 3, 2020, 4:08pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/12 "2020-08-03T16:08:10Z")

</div>

You’ll want something like this:

```auto
api.startAsyncSyntheticEvent(); <br>fetch('<yourRequest>', {<br> method: 'POST',<br> headers: {<br> 'content-type': 'application/json'},<br> body: '<yourBody>'<br>}).then(response => response.text()).then(text => {<br> try {<br> api.info('Success');<br> api.finish();<br> } else {<br> api.fail("Invalid Response");<br> }<br> } catch (err) {<br> api.fail("Failed to Execute");<br> } });

```

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [August 3, 2020, 4:36pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/13 "2020-08-03T16:36:52Z")

</div>

Thanks Hannah,

I’m finally done, but didn’t use the POST after all, because there were Javascript tricks, so I had to reverse engineer the HTML/Javascript code, and in the ending it was quite easier than I would have thought.

What seems could be a limitation around the few options available in Dynatrace, is easily worked around with Javascript 🙂

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 3, 2020, 5:06pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/14 "2020-08-03T17:06:51Z")

</div>

Great Team Work!

---

<div class="post-metadata">

**Author:** ![Cesarlopezh](https://avatars.discourse-cdn.com/v4/letter/c/a5b964/32.png) [@Cesarlopezh](https://community.dynatrace.com/u/Cesarlopezh)\
**Post date:** [April 25, 2023, 4:33pm UTC](https://community.dynatrace.com/t/how-to-do-a-post-event-in-synthetic-browser-monitoring/19949/15 "2023-04-25T16:33:59Z")

</div>

Hi Antonio,

Can you post the solution?
