Running Cookie Robot
Please read the Material Usage Rules on this site.
Description: This method starts Cookie Robot for the specified browser profiles. The robot opens each profile's browser and visits the provided URLs to collect cookies.
Request parameters:
| Parameter | Type | Format | Default | Description |
|---|---|---|---|---|
| urls | array[string] | (empty) | List of URLs for Cookie Robot to visit. The parameter can be specified more than once. | |
| shuffleUrls | boolean | false | Whether to shuffle the list of URLs before visiting. | |
| loadImages | boolean | false | Whether to load images while visiting pages. | |
| minVisitTimeSeconds | integer | int32 | 5 | Minimum time in seconds to spend on each URL. |
| maxVisitTimeSeconds | integer | int32 | 10 | Maximum time in seconds to spend on each URL. |
| workspaceId | integer | int64 | -1 | Workspace identifier. -1 means the default workspace. |
Request body:
| Field | Type | Format | Required | Description |
|---|---|---|---|---|
| body | array[string] | uuid | (optional) | Array of profile IDs to run Cookie Robot for. |
Example request:
POST
CURL:
curl 'http://localhost:8160/v1/profiles/run_cookie_robot?urls=https%3A%2F%2Fexample.com&urls=https%3A%2F%2Fexample.org&shuffleUrls=false&loadImages=false&minVisitTimeSeconds=5&maxVisitTimeSeconds=10&workspaceId=-1' \
--request POST \
--header 'Api-Token: YOUR_SECRET_TOKEN' \
--header 'Content-Type: application/json' \
--data '[
"123e4567-e89b-12d3-a456-426614174000"
]'
C#:
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:8160/v1/profiles/run_cookie_robot?urls=https%3A%2F%2Fexample.com&urls=https%3A%2F%2Fexample.org&shuffleUrls=false&loadImages=false&minVisitTimeSeconds=5&maxVisitTimeSeconds=10&workspaceId=-1"),
Headers =
{
{ "Api-Token", "YOUR_SECRET_TOKEN" },
},
};
request.Content = new StringContent("[\n \"123e4567-e89b-12d3-a456-426614174000\"\n]", Encoding.UTF8, "application/json");
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
Cube:
http://localhost:8160/v1/profiles/run_cookie_robot?urls=https%3A%2F%2Fexample.com&urls=https%3A%2F%2Fexample.org&shuffleUrls=false&loadImages=false&minVisitTimeSeconds=5&maxVisitTimeSeconds=10&workspaceId=-1
Body (JSON):
[
"123e4567-e89b-12d3-a456-426614174000"
]
Additionally:
User-Agent: {-Profile.UserAgent-}
Api-Token: Token from UserArea2.
Response API:
| Response code | Result |
|---|---|
200 OK | OK |
401 Unauthorized | Unauthorized |
403 Forbidden | Forbidden |
500 Internal Server Error | Internal Server Error |
Success Response (200 OK):
{
"runId": "223e4567-e89b-12d3-a456-426614174000"
}
Use the runId value with the Get Script Run Status method.
Error Response (500):
{
"message": null
}