Spaces
Create a space
Create a new space from a configuration object. Creates the directory and files.
POST
/
api
/
workspaces
/
create
cURL
curl -X POST http://localhost:18080/api/workspaces/create \
-H 'Content-Type: application/json' \
-d '{
"config": {
"version": "1.0",
"workspace": {
"name": "my-space",
"description": "A new space"
}
}
}'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({config: {}, workspaceName: '<string>', ephemeral: false})
};
fetch('http://localhost:18080/api/workspaces/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/workspaces/create"
payload = {
"config": {},
"workspaceName": "<string>",
"ephemeral": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/workspaces/create"
payload := strings.NewReader("{\n \"config\": {},\n \"workspaceName\": \"<string>\",\n \"ephemeral\": false\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))
}{
"success": true,
"workspace": {
"id": "abc123",
"name": "my-space",
"description": "My first space",
"status": "active",
"path": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastSeen": "2023-11-07T05:31:56Z"
},
"created": true,
"workspacePath": "<string>",
"filesCreated": [
"<string>"
]
}Body
application/json
⌘I
cURL
curl -X POST http://localhost:18080/api/workspaces/create \
-H 'Content-Type: application/json' \
-d '{
"config": {
"version": "1.0",
"workspace": {
"name": "my-space",
"description": "A new space"
}
}
}'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({config: {}, workspaceName: '<string>', ephemeral: false})
};
fetch('http://localhost:18080/api/workspaces/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/workspaces/create"
payload = {
"config": {},
"workspaceName": "<string>",
"ephemeral": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/workspaces/create"
payload := strings.NewReader("{\n \"config\": {},\n \"workspaceName\": \"<string>\",\n \"ephemeral\": false\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))
}{
"success": true,
"workspace": {
"id": "abc123",
"name": "my-space",
"description": "My first space",
"status": "active",
"path": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastSeen": "2023-11-07T05:31:56Z"
},
"created": true,
"workspacePath": "<string>",
"filesCreated": [
"<string>"
]
}
