Create an environment
Creates an environment in the scoped project. Rejected for projects managed by environments.yaml.
curl --request POST \
--url https://api.empirical.run/api/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"tags": [
"<string>"
],
"exclude_tags": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>"
}
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"tags": ["<string>"],
"exclude_tags": ["<string>"],
"scheduled_trigger": "<string>",
"scheduled_concurrency": { "group": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
playwright_projects_match: ['<string>'],
playwright_projects_ignore: ['<string>'],
tags: ['<string>'],
exclude_tags: ['<string>'],
scheduled_trigger: '<string>',
scheduled_concurrency: {group: '<string>'}
})
};
fetch('https://api.empirical.run/api/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'playwright_projects_match' => [
'<string>'
],
'playwright_projects_ignore' => [
'<string>'
],
'tags' => [
'<string>'
],
'exclude_tags' => [
'<string>'
],
'scheduled_trigger' => '<string>',
'scheduled_concurrency' => [
'group' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.empirical.run/api/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"environment": {
"id": 123,
"project_id": 123,
"slug": "<string>",
"name": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"tags": [
"<string>"
],
"exclude_tags": [
"<string>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>",
"on_conflict": "cancel"
},
"reporter_config": {
"schema_version": 1,
"reporters": [
{
"reporter_type": "slack_run_status",
"slack_channel_ids": [
2
]
}
]
},
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Authorizations
Body
Tags selecting the tests to run (e.g. @smoke); a missing @ is added. A test runs when one of its tags contains any of them, so smoke also selects @smoke-nightly. A test title is not a tag: checkout flow matches no test. To run specific tests, use test_case_ids. Saved for runs in this environment; a trigger request that sends this field replaces it.
1Tags whose tests are skipped (e.g. @slow). Applied after every other selection, so it can only remove tests: with tags it runs tests matching tags but not exclude_tags; alone it runs every test except the excluded ones. Saved for runs in this environment; a trigger request that sends this field replaces it.
1Was this page helpful?
curl --request POST \
--url https://api.empirical.run/api/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"tags": [
"<string>"
],
"exclude_tags": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>"
}
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"tags": ["<string>"],
"exclude_tags": ["<string>"],
"scheduled_trigger": "<string>",
"scheduled_concurrency": { "group": "<string>" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
playwright_projects_match: ['<string>'],
playwright_projects_ignore: ['<string>'],
tags: ['<string>'],
exclude_tags: ['<string>'],
scheduled_trigger: '<string>',
scheduled_concurrency: {group: '<string>'}
})
};
fetch('https://api.empirical.run/api/environments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/environments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'slug' => '<string>',
'playwright_projects_match' => [
'<string>'
],
'playwright_projects_ignore' => [
'<string>'
],
'tags' => [
'<string>'
],
'exclude_tags' => [
'<string>'
],
'scheduled_trigger' => '<string>',
'scheduled_concurrency' => [
'group' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/environments"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.empirical.run/api/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/environments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"playwright_projects_match\": [\n \"<string>\"\n ],\n \"playwright_projects_ignore\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"exclude_tags\": [\n \"<string>\"\n ],\n \"scheduled_trigger\": \"<string>\",\n \"scheduled_concurrency\": {\n \"group\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"environment": {
"id": 123,
"project_id": 123,
"slug": "<string>",
"name": "<string>",
"playwright_projects_match": [
"<string>"
],
"playwright_projects_ignore": [
"<string>"
],
"tags": [
"<string>"
],
"exclude_tags": [
"<string>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"scheduled_concurrency": {
"group": "<string>",
"on_conflict": "cancel"
},
"reporter_config": {
"schema_version": 1,
"reporters": [
{
"reporter_type": "slack_run_status",
"slack_channel_ids": [
2
]
}
]
},
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}