cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cookie while triggering on-demand execution of browser click-path

AK
Pro

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

9 REPLIES 9

Hi @AK ,

Have you tried setting the cookie in the "Advanced Settings" settings and tested if it works?

erh_inetum_1-1713936068775.png

 

Regards,

Elena.

@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

 

PacoPorro
Dynatrace Leader
Dynatrace Leader

@PacoPorro,

Thanks for the response. However, I would need help in passing cookie while triggering on-demand synthetic execution via API

Regards,

AK

AK
Pro

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,

AK_0-1714044666864.png

Regards

AK

@HannahM,

Is it something that is achievable?

Regards,

AK

HannahM
Dynatrace Leader
Dynatrace Leader

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. 

 

Synthetic SME and community advocate.

@HannahM, thanks for confirmation.

Regards,

AK

AK
Pro

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

Featured Posts