CookieStore.AddCookies
  • 06 Mar 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

CookieStore.AddCookies

  • Dark
    Light
  • PDF

Article Summary

Description

Adds one or more cookies to an existing cookie store from valid JSON POST data.

URL parameters

URL parameter ordering

The URL parameters below are listed in the order they should be entered in the API URL.

NameRequiredTypeDescription
CookieStoreIDTruenumericUnique identifier of the cookie store.
CookieStoreNameTruestringThe name of the cookie store.

Request body

JSON

Must be valid JSON with the following properties:

NameRequiredTypeDescription
NameTruestringThe name of the cookie.
DomainTruestringThe domain of the cookie.
ValueFalsestringThe value of the cookie.
HttpOnlyFalsebooleanTrue to set the HttpOnly flag on the cookie.
SecureFalsebooleanTrue to set the Secure flag on the cookie.
PathFalsestringThe cookie path.
[
  {
    "Name": "First cookie from JSON",
    "Domain": "www.mozenda.com",
    "Value": "First cookie value",
    "Secure": "True",
    "HttpOnly": "True",
    "Secure": "True"
  },
  {
    "Name": "Second cookie from JSON",
    "Domain": "help.mozenda.com",
    "Value": "Second cookie value",
    "HttpOnly": "True",
    "Secure": "True"
  }
]

Responses

NameTypeDescription
ResultstringSuccess if the operation was successful.
CookieStoreIDnumericUnique identifier for the cookie store.
NewCookieCountnumericThe number of cookies set by the call.

Sample request

curl -X POST 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX&Service=Mozenda10&Operation=CookieStore.AddCookies&CookieStoreID=1001' \
-d '[{"Name":"First cookie from JSON","Domain":"lowes1.mozenda.com","Value":"First cookie value", "HttpOnly": "True"},{"Name":"Second cookie from JSON","Domain":"lowes2.mozenda.com","Value":"Second cookie value"}]'

Sample responses

XML

<?xml version="1.0" encoding="utf-8"?>
<CookieStoreAddCookiesResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<Result>Success</Result>
	<CookieStoreID>1006</CookieStoreID>
	<NewCookieCount>2</NewCookieCount>
</CookieStoreAddCookiesResponse>

JSON (add &ResponseFormat=JSON)

{
  "CookieStoreID": 1001,
  "NewCookieCount": 2,
  "JsonResult": {
    "Command": "CookieStore.AddCookies",
    "AutoLoggedIn": false,
    "WebConsoleKey": "",
    "Result": "Success",
    "ErrorCode": "",
    "ErrorDescription": "",
    "ErrorList": [],
    "ExecutionTime": {
      "Ticks": 0,
      "Days": 0,
      "Hours": 0,
      "Milliseconds": 0,
      "Minutes": 0,
      "Seconds": 0,
      "TotalDays": 0,
      "TotalHours": 0,
      "TotalMilliseconds": 0,
      "TotalMinutes": 0,
      "TotalSeconds": 0
    }
  }
}

Was this article helpful?