Creating a New Cookie Runner Script

The Create New Cookie Runner Script API allows you to create more than one cookie at a time. The API is designed to be used in conjunction with the Create New Cookie API.

You will need to provide the individual cookie information, as you would for singular use, but the runner script will automatically run through the list of cookies to create and will prevent you from having to manually run the API once per cookie.

1. Insert the request body and header

Request body.

{{jsonBody}}

Request body.

2. Enter the pre-request script

Enter the pre-request script in the Pre-Request Script tab.
Pre-request.

pm.globals.set("jsonBody", JSON.stringify(pm.iterationData.toObject())

Pre-request script.

Click the Runner button when finished.

Runner button.

3. Create your data source

Create your data source by entering the script as it appears below. All quotations should be populated if required, and length, durationType, and thirdParty content updated as needed per the options available on the Create New Cookie API.
Data source.

[
    {
            "cookieName": "",
            "lifespan": "",
            "host": "",
            "description": "",
            "customCategoryName": "",
            "length": 0,
            "durationType": 1,
            "domainCookieCategoryList": [
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                }
            ] 
    },

    {
            "cookieName": "",
            "lifespan": "",
            "host": "",
            "description": "",
            "customCategoryName": "",
            "length": 0,
            "durationType": 1,
            "domainCookieCategoryList": [
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                }
            ]
    },  
		{
			"cookieName": "",
			"lifespan": "",
			"host": "",
			"description": "",
			"customCategoryName": "",
			"length": 0,
			"durationType": 1,
			"domainCookieCategoryList": [
				{
						"domainId":"",
						"customCategoryName":"",
						"thirdParty":false
				},
				{
						"domainId":"",
						"customCategoryName":"",
						"thirdParty":false
				},
				{
						"domainId":"",
						"customCategoryName":"",
						"thirdParty":false
				}
				]
    },  
        {
                "cookieName": "",
                "lifespan": "",
                "host": "",
                "description": "",
                "customCategoryName": "",
                "length": 0,
                "durationType": 1,
                "domainCookieCategoryList": [
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                },
                {
                        "domainId":"",
                        "customCategoryName":"",
                        "thirdParty":false
                }
                ]
        }
]
    

When finished, save the script as a JSON file.

4. Confirm formatting

Use the Create New Cookie API to confirm formatting.

5. Upload to Postman

Upload the file to Postman. Click the Run button once complete.

Use the Select File button to upload the JSON file.

6. View your results

View HTTP response status codes. These status codes communicate the results of processing requests.

Response status codes.