Artifacts
Upload file as artifact
Upload a file and convert it to an artifact.
POST
/
api
/
artifacts
/
upload
cURL
curl -X POST http://localhost:18080/api/artifacts/upload \
-F 'file=@report.csv' \
-F 'workspaceId=my-space-id'const form = new FormData();
form.append('file', '<string>');
form.append('chatId', '<string>');
form.append('workspaceId', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('http://localhost:18080/api/artifacts/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/artifacts/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"chatId": "<string>",
"workspaceId": "<string>"
}
response = requests.post(url, data=payload, files=files)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/artifacts/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chatId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"workspaceId\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"artifact": {
"id": "<string>",
"name": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"revision": 123
}
}⌘I
cURL
curl -X POST http://localhost:18080/api/artifacts/upload \
-F 'file=@report.csv' \
-F 'workspaceId=my-space-id'const form = new FormData();
form.append('file', '<string>');
form.append('chatId', '<string>');
form.append('workspaceId', '<string>');
const options = {method: 'POST'};
options.body = form;
fetch('http://localhost:18080/api/artifacts/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:18080/api/artifacts/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"chatId": "<string>",
"workspaceId": "<string>"
}
response = requests.post(url, data=payload, files=files)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:18080/api/artifacts/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chatId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"workspaceId\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"success": true,
"artifact": {
"id": "<string>",
"name": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"revision": 123
}
}
