curl --request POST \
--url https://api.example.com/v1/projects/{project}/boxes/{name}/services \
--header 'Content-Type: application/json' \
--data '
{
"command": [
"<string>"
],
"name": "<string>",
"cwd": "<string>",
"env": {},
"port": 1,
"publish": {
"name": "<string>",
"public": true
},
"ready": {
"http": "<string>",
"port": 1,
"status": 1,
"tcp": 1,
"timeout_secs": 1
},
"restart": "<string>",
"secret_env": [
"<string>"
],
"stop": {
"grace_secs": 1,
"signal": "<string>"
},
"tags": {},
"user": "<string>"
}
'import requests
url = "https://api.example.com/v1/projects/{project}/boxes/{name}/services"
payload = {
"command": ["<string>"],
"name": "<string>",
"cwd": "<string>",
"env": {},
"port": 1,
"publish": {
"name": "<string>",
"public": True
},
"ready": {
"http": "<string>",
"port": 1,
"status": 1,
"tcp": 1,
"timeout_secs": 1
},
"restart": "<string>",
"secret_env": ["<string>"],
"stop": {
"grace_secs": 1,
"signal": "<string>"
},
"tags": {},
"user": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
command: ['<string>'],
name: '<string>',
cwd: '<string>',
env: {},
port: 1,
publish: {name: '<string>', public: true},
ready: {http: '<string>', port: 1, status: 1, tcp: 1, timeout_secs: 1},
restart: '<string>',
secret_env: ['<string>'],
stop: {grace_secs: 1, signal: '<string>'},
tags: {},
user: '<string>'
})
};
fetch('https://api.example.com/v1/projects/{project}/boxes/{name}/services', 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.example.com/v1/projects/{project}/boxes/{name}/services",
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([
'command' => [
'<string>'
],
'name' => '<string>',
'cwd' => '<string>',
'env' => [
],
'port' => 1,
'publish' => [
'name' => '<string>',
'public' => true
],
'ready' => [
'http' => '<string>',
'port' => 1,
'status' => 1,
'tcp' => 1,
'timeout_secs' => 1
],
'restart' => '<string>',
'secret_env' => [
'<string>'
],
'stop' => [
'grace_secs' => 1,
'signal' => '<string>'
],
'tags' => [
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/projects/{project}/boxes/{name}/services"
payload := strings.NewReader("{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/projects/{project}/boxes/{name}/services")
.header("Content-Type", "application/json")
.body("{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project}/boxes/{name}/services")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"command": [
"<string>"
],
"commands": {
"publish": "<string>",
"start": "<string>",
"unpublish": "<string>"
},
"name": "<string>",
"restart": "<string>",
"restarts": 1,
"state": "<string>",
"error": "<string>",
"last_exit_code": 123,
"pid": 123,
"port": 1,
"tags": {},
"url": "<string>",
"user": "<string>",
"warning": "<string>"
}Post v1projects boxes services
curl --request POST \
--url https://api.example.com/v1/projects/{project}/boxes/{name}/services \
--header 'Content-Type: application/json' \
--data '
{
"command": [
"<string>"
],
"name": "<string>",
"cwd": "<string>",
"env": {},
"port": 1,
"publish": {
"name": "<string>",
"public": true
},
"ready": {
"http": "<string>",
"port": 1,
"status": 1,
"tcp": 1,
"timeout_secs": 1
},
"restart": "<string>",
"secret_env": [
"<string>"
],
"stop": {
"grace_secs": 1,
"signal": "<string>"
},
"tags": {},
"user": "<string>"
}
'import requests
url = "https://api.example.com/v1/projects/{project}/boxes/{name}/services"
payload = {
"command": ["<string>"],
"name": "<string>",
"cwd": "<string>",
"env": {},
"port": 1,
"publish": {
"name": "<string>",
"public": True
},
"ready": {
"http": "<string>",
"port": 1,
"status": 1,
"tcp": 1,
"timeout_secs": 1
},
"restart": "<string>",
"secret_env": ["<string>"],
"stop": {
"grace_secs": 1,
"signal": "<string>"
},
"tags": {},
"user": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
command: ['<string>'],
name: '<string>',
cwd: '<string>',
env: {},
port: 1,
publish: {name: '<string>', public: true},
ready: {http: '<string>', port: 1, status: 1, tcp: 1, timeout_secs: 1},
restart: '<string>',
secret_env: ['<string>'],
stop: {grace_secs: 1, signal: '<string>'},
tags: {},
user: '<string>'
})
};
fetch('https://api.example.com/v1/projects/{project}/boxes/{name}/services', 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.example.com/v1/projects/{project}/boxes/{name}/services",
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([
'command' => [
'<string>'
],
'name' => '<string>',
'cwd' => '<string>',
'env' => [
],
'port' => 1,
'publish' => [
'name' => '<string>',
'public' => true
],
'ready' => [
'http' => '<string>',
'port' => 1,
'status' => 1,
'tcp' => 1,
'timeout_secs' => 1
],
'restart' => '<string>',
'secret_env' => [
'<string>'
],
'stop' => [
'grace_secs' => 1,
'signal' => '<string>'
],
'tags' => [
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/v1/projects/{project}/boxes/{name}/services"
payload := strings.NewReader("{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/v1/projects/{project}/boxes/{name}/services")
.header("Content-Type", "application/json")
.body("{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project}/boxes/{name}/services")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": [\n \"<string>\"\n ],\n \"name\": \"<string>\",\n \"cwd\": \"<string>\",\n \"env\": {},\n \"port\": 1,\n \"publish\": {\n \"name\": \"<string>\",\n \"public\": true\n },\n \"ready\": {\n \"http\": \"<string>\",\n \"port\": 1,\n \"status\": 1,\n \"tcp\": 1,\n \"timeout_secs\": 1\n },\n \"restart\": \"<string>\",\n \"secret_env\": [\n \"<string>\"\n ],\n \"stop\": {\n \"grace_secs\": 1,\n \"signal\": \"<string>\"\n },\n \"tags\": {},\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"command": [
"<string>"
],
"commands": {
"publish": "<string>",
"start": "<string>",
"unpublish": "<string>"
},
"name": "<string>",
"restart": "<string>",
"restarts": 1,
"state": "<string>",
"error": "<string>",
"last_exit_code": 123,
"pid": 123,
"port": 1,
"tags": {},
"url": "<string>",
"user": "<string>",
"warning": "<string>"
}Body
Working directory the service is spawned in (absolute path inside the box). The spawn fails if it does not exist.
Environment exported to the child (wins over /etc/boxes-env).
Show child attributes
Show child attributes
The port the service listens on. Optional: a worker service listens on
nothing. Required when --publish is given.
x >= 0Optional sugar: also publish the service's port under this name.
Show child attributes
Show child attributes
Readiness gate; start blocks until it passes or fails.
Show child attributes
Show child attributes
Restart policy: always (default), on-failure, or never.
Names of env keys whose values are secret. Their values are redacted in
the reproducible commands.start hint; each must be a key of env.
How the service is asked to stop before it is force-killed.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Run the service as this box-local user (getpwnam + setuid).
Response
Service started
Show child attributes
Show child attributes
x >= 0Set only on a corrupt-spec tombstone: why the on-disk spec did not load.
x >= 0Show child attributes
Show child attributes
Present only when a --publish start fell back to public because no
auth provider is configured (same warning as box/service publish).