Skip to main content

Creating Multiple Browser Instances

Description: This method is used to create browser instances in bulk for the specified profiles. Please ensure that the provided profile IDs are valid and the specified workspace ID exists.

Request parameters:

ParameterTypeFormatDefaultDescription
workspaceIdintegerint64-1Workspace identifier. -1 means the default workspace.
desktopNamestring(empty)The name of the desktop environment (optional).
keepAliveлогическое значениеtrueThis value indicates if the browser instances should remain active after creation. Set ”true” to keep the instances active; otherwise, false. Defaults to true (true или false).
bodyJSON-ArrayThe array of profile UUIDs to create browser instances for. Example: ["uuid1", "uuid2"]
note

The list of profile IDs for browser instances to create should be passed as an array in the request body using the following format:

[
"884d8f8d-9a4e-4b1e-9dd3-a028d3ae419b",
"d24eba34-12d6-4412-ab20-80fae618c264"
]

Example request:

POST
CURL:

curl 'http://localhost:8160/v1/browser_instances/create_bulk?workspaceId=-1&desktopName=&keepAlive=true' \
--request POST \
--header 'Content-Type: application/json' \
--header 'Api-Token: YOUR_SECRET_TOKEN' \
--data '[
"uuid1",
"uuid2"
]'

C#:

using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:8160/v1/browser_instances/create_bulk?workspaceId=-1&desktopName=&keepAlive=true"),
Headers =
{
{ "Api-Token", "YOUR_SECRET_TOKEN" },
},
Content = new StringContent("[\n " +
"\"uuid1\"," +
"\"uuid2\"," +
"\n]")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("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/browser_instances/create_bulk?workspaceId=-1&desktopName=&keepAlive=true

Data:
["uuid1", "uuid2"]

Additionally:
User-Agent: {-Profile.UserAgent-}
Api-Token: Token from UserArea2.

Response API:

Response codeResult
200 OKSuccess
500 ErrorInternal Server Error

Success Response (200 OK):

Returns an array of created browser instances:

[
{
"profileId": "123e4567-e89b-12d3-a456-426614174000",
"processId": 1,
"connectionString": null
}
]

Error Response (500):

{
"message": null
}