Create an environment
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>"
],
"scheduled_trigger": "<string>"
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"scheduled_trigger": "<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>'],
scheduled_trigger: '<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>'
],
'scheduled_trigger' => '<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 \"scheduled_trigger\": \"<string>\"\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 \"scheduled_trigger\": \"<string>\"\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 \"scheduled_trigger\": \"<string>\"\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>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Environments
Create an environment
Creates an environment in the scoped project. Rejected for projects managed by environments.yaml.
POST
/
api
/
environments
Create an environment
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>"
],
"scheduled_trigger": "<string>"
}
'import requests
url = "https://api.empirical.run/api/environments"
payload = {
"name": "<string>",
"slug": "<string>",
"playwright_projects_match": ["<string>"],
"playwright_projects_ignore": ["<string>"],
"scheduled_trigger": "<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>'],
scheduled_trigger: '<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>'
],
'scheduled_trigger' => '<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 \"scheduled_trigger\": \"<string>\"\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 \"scheduled_trigger\": \"<string>\"\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 \"scheduled_trigger\": \"<string>\"\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>"
],
"is_disabled": true,
"env_files": [
"<string>"
],
"scheduled_trigger": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Display name.
Minimum string length:
1URL-friendly identifier; unique within the project.
Minimum string length:
1Playwright project names to include. Items must not start with '!'.
Playwright project names to exclude.
Cron expression for scheduled triggers, or null.
Response
The created environment.
Response payload.
Show child attributes
Show child attributes
Was this page helpful?
⌘I