curl --request POST \
--url https://envlink-api.projectinwork.com/v1/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template": "linux-build",
"sandbox": "<string>",
"shares": {
"src": "."
},
"labels": {},
"idle": "30m",
"hard": "6h",
"project": "github.com/acme/app",
"snapshot": "<string>",
"restore": [
"<string>"
],
"include": [
"<string>"
],
"noIgnore": true,
"files": {}
}
'import requests
url = "https://envlink-api.projectinwork.com/v1/environments"
payload = {
"template": "linux-build",
"sandbox": "<string>",
"shares": { "src": "." },
"labels": {},
"idle": "30m",
"hard": "6h",
"project": "github.com/acme/app",
"snapshot": "<string>",
"restore": ["<string>"],
"include": ["<string>"],
"noIgnore": True,
"files": {}
}
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({
template: 'linux-build',
sandbox: '<string>',
shares: {src: '.'},
labels: {},
idle: '30m',
hard: '6h',
project: 'github.com/acme/app',
snapshot: '<string>',
restore: ['<string>'],
include: ['<string>'],
noIgnore: true,
files: {}
})
};
fetch('https://envlink-api.projectinwork.com/v1/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://envlink-api.projectinwork.com/v1/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([
'template' => 'linux-build',
'sandbox' => '<string>',
'shares' => [
'src' => '.'
],
'labels' => [
],
'idle' => '30m',
'hard' => '6h',
'project' => 'github.com/acme/app',
'snapshot' => '<string>',
'restore' => [
'<string>'
],
'include' => [
'<string>'
],
'noIgnore' => true,
'files' => [
]
]),
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://envlink-api.projectinwork.com/v1/environments"
payload := strings.NewReader("{\n \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\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://envlink-api.projectinwork.com/v1/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://envlink-api.projectinwork.com/v1/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 \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\n}"
response = http.request(request)
puts response.read_body{
"environment": {
"id": "env_3iynbifi4k6xgfhn",
"name": "linux-build-3f2a",
"template": "linux-build",
"state": "pending",
"node": "<string>",
"sandbox": "<string>",
"pool": "linux-arm64",
"labels": {},
"project": "github.com/acme/app",
"readyMs": 123,
"error": "<string>",
"createdBy": "<string>",
"created": "2023-11-07T05:31:56Z",
"ready": "2023-11-07T05:31:56Z",
"stopped": "2023-11-07T05:31:56Z",
"expires": "2023-11-07T05:31:56Z",
"idleUntil": "2023-11-07T05:31:56Z",
"idle": "1h0m0s",
"hard": "6h0m0s",
"exports": [
{
"service": "postgres",
"listen": "127.0.0.1:5432",
"target": "127.0.0.1:5432"
}
],
"shares": [
{
"name": "src",
"direction": "in",
"envPath": "/work",
"localPath": ".",
"files": [
"<string>"
]
}
],
"snapshot": "<string>",
"restored": {
"key": "<string>",
"root": "<string>",
"files": 123,
"created": "2023-11-07T05:31:56Z"
}
},
"sandboxConfig": {}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Create an environment
Leases an environment from a template and queues it for a hot node. Poll GET /v1/environments/{id} until state is ready. When a sandbox is given, the answer includes the sandbox’s new envd configuration.
curl --request POST \
--url https://envlink-api.projectinwork.com/v1/environments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template": "linux-build",
"sandbox": "<string>",
"shares": {
"src": "."
},
"labels": {},
"idle": "30m",
"hard": "6h",
"project": "github.com/acme/app",
"snapshot": "<string>",
"restore": [
"<string>"
],
"include": [
"<string>"
],
"noIgnore": true,
"files": {}
}
'import requests
url = "https://envlink-api.projectinwork.com/v1/environments"
payload = {
"template": "linux-build",
"sandbox": "<string>",
"shares": { "src": "." },
"labels": {},
"idle": "30m",
"hard": "6h",
"project": "github.com/acme/app",
"snapshot": "<string>",
"restore": ["<string>"],
"include": ["<string>"],
"noIgnore": True,
"files": {}
}
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({
template: 'linux-build',
sandbox: '<string>',
shares: {src: '.'},
labels: {},
idle: '30m',
hard: '6h',
project: 'github.com/acme/app',
snapshot: '<string>',
restore: ['<string>'],
include: ['<string>'],
noIgnore: true,
files: {}
})
};
fetch('https://envlink-api.projectinwork.com/v1/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://envlink-api.projectinwork.com/v1/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([
'template' => 'linux-build',
'sandbox' => '<string>',
'shares' => [
'src' => '.'
],
'labels' => [
],
'idle' => '30m',
'hard' => '6h',
'project' => 'github.com/acme/app',
'snapshot' => '<string>',
'restore' => [
'<string>'
],
'include' => [
'<string>'
],
'noIgnore' => true,
'files' => [
]
]),
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://envlink-api.projectinwork.com/v1/environments"
payload := strings.NewReader("{\n \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\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://envlink-api.projectinwork.com/v1/environments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://envlink-api.projectinwork.com/v1/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 \"template\": \"linux-build\",\n \"sandbox\": \"<string>\",\n \"shares\": {\n \"src\": \".\"\n },\n \"labels\": {},\n \"idle\": \"30m\",\n \"hard\": \"6h\",\n \"project\": \"github.com/acme/app\",\n \"snapshot\": \"<string>\",\n \"restore\": [\n \"<string>\"\n ],\n \"include\": [\n \"<string>\"\n ],\n \"noIgnore\": true,\n \"files\": {}\n}"
response = http.request(request)
puts response.read_body{
"environment": {
"id": "env_3iynbifi4k6xgfhn",
"name": "linux-build-3f2a",
"template": "linux-build",
"state": "pending",
"node": "<string>",
"sandbox": "<string>",
"pool": "linux-arm64",
"labels": {},
"project": "github.com/acme/app",
"readyMs": 123,
"error": "<string>",
"createdBy": "<string>",
"created": "2023-11-07T05:31:56Z",
"ready": "2023-11-07T05:31:56Z",
"stopped": "2023-11-07T05:31:56Z",
"expires": "2023-11-07T05:31:56Z",
"idleUntil": "2023-11-07T05:31:56Z",
"idle": "1h0m0s",
"hard": "6h0m0s",
"exports": [
{
"service": "postgres",
"listen": "127.0.0.1:5432",
"target": "127.0.0.1:5432"
}
],
"shares": [
{
"name": "src",
"direction": "in",
"envPath": "/work",
"localPath": ".",
"files": [
"<string>"
]
}
],
"snapshot": "<string>",
"restored": {
"key": "<string>",
"root": "<string>",
"files": 123,
"created": "2023-11-07T05:31:56Z"
}
},
"sandboxConfig": {}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
A CLI token or an organization API key.
Body
"linux-build"
The sandbox to wire it to; needed for shares and for services on localhost.
A template in share → a folder on the sandbox, relative to its folder.
Show child attributes
Show child attributes
{ "src": "." }
Show child attributes
Show child attributes
"30m"
At most 24h.
"6h"
Whose key seals its files; default.
"github.com/acme/app"
Save its synced files under this key when it ends.
Snapshot keys to start from, in order: exact match, then the newest prefix match. Defaults to snapshot.
Paths or globs to send even if .gitignore or the defaults leave them out.
Don't apply .gitignore files or the default ignores.
Extra files: destination in the share → source on the sandbox.
Show child attributes
Show child attributes