Asset hochladen
curl --request POST \
--url https://api.truthlocks.com/v1/assets/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.truthlocks.com/v1/assets/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/assets/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/assets/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--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "<string>",
"url": "<string>",
"content_type": "<string>",
"size": 123,
"purpose": "<string>",
"created_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Assets
Ein Asset hochladen
Lädt eine Datei in den Asset-Store hoch zur Verwendung mit Ausstellern, Nachweisen und Branding.
POST
/
v1
/
assets
/
upload
Asset hochladen
curl --request POST \
--url https://api.truthlocks.com/v1/assets/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.truthlocks.com/v1/assets/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/assets/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/assets/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--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "<string>",
"url": "<string>",
"content_type": "<string>",
"size": 123,
"purpose": "<string>",
"created_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Senden Sie eine Datei als Multipart-Feld
file innerhalb des 5 MB Anfragelimits. Der Multipart-Umschlag beansprucht ebenfalls Speicherplatz, halten Sie die Datei also unter dem Limit. Speichern Sie die zurückgegebene Asset-ID für einen späteren Abruf.
Der Endpunkt speichert die übermittelten Bytes; er stellt nicht unabhängig fest, dass hochgeladene Beweismittel authentisch sind. Siehe Asset abrufen für den Zugriff auf eine gespeicherte Datei.Autorisierungen
Body
multipart/form-data

