curl --request PUT \
--url https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Range: <content-range>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'import requests
url = "https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}"
payload = "<string>"
headers = {
"Content-Range": "<content-range>",
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Content-Range': '<content-range>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/octet-stream'
},
body: '<string>'
};
fetch('https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}', 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://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Range: <content-range>",
"Content-Type: application/octet-stream"
],
]);
$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://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Range", "<content-range>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}")
.header("Content-Range", "<content-range>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/octet-stream")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Range"] = '<content-range>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"size_bytes": 123,
"offset": 1,
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>",
"offset": 1
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Send one window of an upload
Appends the bytes Content-Range names. A window must start at the upload offset, carry exactly end-start+1 bytes, and name the declared size as its total. A rejected window leaves the offset unchanged. When the window ending at total-1 lands, the upload seals into a Model and its scan starts; the response then carries model_id. Sending that last window again answers the sealed upload.
curl --request PUT \
--url https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Range: <content-range>' \
--header 'Content-Type: application/octet-stream' \
--data '<string>'import requests
url = "https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}"
payload = "<string>"
headers = {
"Content-Range": "<content-range>",
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.put(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'Content-Range': '<content-range>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/octet-stream'
},
body: '<string>'
};
fetch('https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}', 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://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Range: <content-range>",
"Content-Type: application/octet-stream"
],
]);
$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://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Range", "<content-range>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}")
.header("Content-Range", "<content-range>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/octet-stream")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}.earnie.dev/v1/projects/{projectId}/model-uploads/{uploadId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Range"] = '<content-range>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"size_bytes": 123,
"offset": 1,
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"model_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>",
"offset": 1
}{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Authorizations
An Earnie API key, sent as Authorization: Bearer sk_earnie_.... Create one under Settings > API keys. The key's scopes decide which operations it may call.
Headers
RFC 9110 byte range, e.g. bytes 0-16777215/2986344448.
Body
The body is of type file.
Response
The window was accepted.
Bytes the server holds. The next window starts here.
x >= 0When an upload that receives no more bytes is discarded. Every accepted window moves it forward.
The Model the bytes sealed into, once the last window landed. When the same bytes were uploaded before, this is the existing Model.