23 Apr 2024 08:59 PM - last edited on 10 May 2024 03:48 PM by Michal_Gebacki
Hi,
I'm triggering on-demand execution for one of our browser click-path monitor. Use case is to pass another navigation URL and associated new cookie. The way to achieve this is by adding customized script with event and cookie.
I'm able to pass the navigate event but how do I pass cookie in request body. I tried to add cookie like below but that didn't worked.
{
"processingMode": "EXECUTIONS_DETAILS_ONLY",
"failOnPerformanceIssue": true,
"failOnSslWarning": true,
"stopOnProblem": true,
"takeScreenshotsOnSuccess": true,
"monitors": [
{
"customizedScript": {
"events": [
{
"type": "navigate",
"url": "https://test.xyz.com",
}
],
"cookies": [
{
"domain": "test.xyz.com",
"name": "client",
"path": "/summary",
"value": "abcdefghijklmnopqrstuvwxyz="
}
]
},
"monitorId": "SYNTHETIC_TEST-bhb439dhco2cc",
"locations": [
"SYNTHETIC_LOCATION-abcdsjao932ue2"
]
}
]
}
Error is,
{
"error": {
"code": 400,
"message": "Script validation failed: {\"violations\":[{\"path\":\"/cookies/0\",\"message\":\"Illegal property \\\"cookies/0\\\"\"}]}"
}
}
Need help here.
Regards,
AK
Solved! Go to Solution.
24 Apr 2024 06:20 AM - edited 24 Apr 2024 06:21 AM
Hi @AK ,
Have you tried setting the cookie in the "Advanced Settings" settings and tested if it works?
Regards,
Elena.
24 Apr 2024 06:53 AM
@erh_inetum, thank you for your response.
Cookie is already added under advance setup for
firsttest.xyz.com domain
However, I want to trigger on-demand for another domain
i.e. test.xyz.com
This would be having different cookie value.
What I need a help with how can we pass the cookie in request body for on-demand execution?
Regards,
AK
24 Apr 2024 07:30 AM
Take a look on this https://docs.dynatrace.com/docs/shortlink/id-brower-clickpath-events#javascript
Not sure if this can help.
24 Apr 2024 03:45 PM
Thanks for the response. However, I would need help in passing cookie while triggering on-demand synthetic execution via API
Regards,
AK
25 Apr 2024 12:32 PM
Any clue on this guys,
Basically, I'm looking to add cookies which we add under advanced setup. This can be seen under configuration section when we go script mode of synthetic monitor like below,
Regards
AK
26 Apr 2024 10:46 AM
The script configuration section cannot be customized. The list of events that can be customized can be found here but you can customize a cookie step, so you could add a cookie event to the monitor and then modify that on the fly.
28 Apr 2024 08:12 PM - edited 28 Apr 2024 08:13 PM
Well I'm able to get workaround on this.
As we cannot pass the configuration section during on-demand execution, we can remove the cookies added from advance section of browser click-path and add 'cookie' event under recorded click-path and we are good to pass the values during on-demand execution. Below is the request body I used successfully.
{
"processingMode": "EXECUTIONS_DETAILS_ONLY",
"failOnPerformanceIssue": true,
"failOnSslWarning": true,
"stopOnProblem": true,
"takeScreenshotsOnSuccess": true,
"monitors": [
{
"customizedScript": {
"events": [
{
"type": "navigate",
"url": "https://test.xyz.com"
},
{
"type": "cookie",
"cookies": [
{
"domain": "test.xyz.com",
"name": "client",
"path": "/profileV2",
"value": "abcdefghijklmnopqrstuvwxyz="
}
]
}
]
},
"monitorId": "SYNTHETIC_TEST-bhb439dhco2cc",
"locations": [
"SYNTHETIC_LOCATION-abcdsjao932ue2"
]
}
]
}
Hope this is helpful.
Regards,
AK