CookieStore.AddCookies

Prev Next

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.

Name Required Type Description
CookieStoreID True numeric Unique identifier of the cookie store.
CookieStoreName True string The name of the cookie store.

Request body

JSON

Must be valid JSON with the following properties:

Name Required Type Description
Name True string The name of the cookie.
Domain True string The domain of the cookie.
Value False string The value of the cookie.
HttpOnly False boolean True to set the HttpOnly flag on the cookie.
Secure False boolean True to set the Secure flag on the cookie.
Path False string The 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

Name Type Description
Result string Success if the operation was successful.
CookieStoreID numeric Unique identifier for the cookie store.
NewCookieCount numeric The 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
    }
  }
}