Introduction
Vision provides the ability to start and stop profiles via API using HTTP-requests. To send some requests you may need X-Token, you can read more about it in the corresponding article.
Getting auth token
Getting auth token for work with API
Work with profiles
Getting the list of running profiles
In Vision it is possible to get information on profiles that are already running.
Request
To get the list of running profiles you need to send the corresponding GET request:
Request example
1const url =
2 "http://localhost:3030/list";
3
4const options = {
5 method: "GET",
6 headers: {
7 "X-Token": "Your Token",
8 },
9};
10
11fetch(url, options)
12 .then((response) => {
13 response.json().then((data) => {
14 console.log(data);
15 });
16 })
17 .catch((error) => {
18 console.error(error);
19 });
Response example
1{
2 "profiles": [
3 {
4 "folder_id": "698d2698-11a5-4768-bfb8-92b904026bfd",
5 "profile_id": "05296821-1ee5-445c-805f-1523578e898c",
6 "port": null
7 },
8 {
9 "folder_id": "698d2698-11a5-4768-bfb8-92b904026bfd",
10 "profile_id": "98bc0cb8-3cae-483f-bb8c-2607cc5c9883",
11 "port": null
12 },
13 {
14 "folder_id": "698d2698-11a5-4768-bfb8-92b904026bfd",
15 "profile_id": "9c6ed4a3-20b3-441d-adc6-58b99791f67b",
16 "port": null
17 }
18 ]
19}
Start profile by API
Request
To launch a profile, you need to send a corresponding GET or POST request:
Please note that in the request URL it is necessary to pass the ID of the folder - folderId, where the profile to be launched is located, as well as the ID of the profile itself - profileId.
If you want to pass extra arguments to the browser, you can do it by sending a POST request with the JSON body containing the args field with an array of arguments.
Request headers
Request body (optional)
Request example
1const url =
2 "http://localhost:3030/start/{folderId}/{profileId}";
3
4const options = {
5 method: "GET",
6 headers: {
7 "X-Token": "Your Token",
8 },
9};
10
11fetch(url, options)
12 .then((response) => {
13 response.json().then((data) => {
14 console.log(data);
15 });
16 })
17 .catch((error) => {
18 console.error(error);
19 });
Response
Response data
Response example
1{
2 "folder_id": "698d2698-11a5-4768-bfb8-92b904026bfd",
3 "profile_id": "98bc0cb8-3cae-483f-bb8c-2607cc5c9883",
4 "port": 19512
5}
Stopping profile by API
Request
To stop a profile, you need to send a corresponding GET request:
Please note that in the request URL it is necessary to pass the ID of the folder - folderId, where the profile to be launched is located, as well as the ID of the profile itself - profileId.
Request example
1var requestOptions = {
2 method: 'GET',
3 redirect: 'follow'
4};
5
6fetch("http://localhost:3030/stop/FOLDER_ID_HERE/PROFILE_ID_HERE", requestOptions)
7 .then(response => response.text())
8 .then(result => console.log(result))
9 .catch(error => console.log('error', error));
Response
Response example
1Stopping profile 98bc0cb8-3cae-483f-bb8c-2607cc5c9883 in folder 698d2698-11a5-4768-bfb8-92b904026bfd