Assets
Initiate Chunked Upload
Initiate chunked uploads for one or more assets (batch).
POST
/
assets
/
chunked
/
initiate
Initiate Chunked Upload
curl --request POST \
--url https://api.aspect.inc/assets/chunked/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"directory_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"size_bytes": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
'import requests
url = "https://api.aspect.inc/assets/chunked/initiate"
payload = [
{
"directory_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"size_bytes": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
directory_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
size_bytes: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
])
};
fetch('https://api.aspect.inc/assets/chunked/initiate', 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.aspect.inc/assets/chunked/initiate",
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([
[
'directory_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'size_bytes' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.aspect.inc/assets/chunked/initiate"
payload := strings.NewReader("[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aspect.inc/assets/chunked/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aspect.inc/assets/chunked/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"result": {
"asset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"asset_type": "video",
"asset_name": "<string>",
"chunk_size": 123,
"token": "<string>",
"token_expires_at": "2023-11-07T05:31:56Z"
},
"error": "<string>",
"skipped": true
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
BearerAuthApiKeyAuth
JWT in Authorization header. 'Bearer ' prefix optional.
Body
application/json
ID of the directory this asset belongs to
Filename including extension
Total file size in bytes
Client-generated asset ID (optional, server generates if not provided)
Auto-rename style to use if name conflicts with an existing item. If not set and a conflict exists, returns 409.
Available options:
parenthesized, numeric How to handle name conflicts. 'replace': trash existing asset, create new. 'skip': skip this item if a conflict exists (no asset created). Mutually exclusive with auto_rename.
Available options:
replace, skip ⌘I
Initiate Chunked Upload
curl --request POST \
--url https://api.aspect.inc/assets/chunked/initiate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"directory_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"size_bytes": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
'import requests
url = "https://api.aspect.inc/assets/chunked/initiate"
payload = [
{
"directory_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"size_bytes": 123,
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
directory_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
size_bytes: 123,
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
])
};
fetch('https://api.aspect.inc/assets/chunked/initiate', 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.aspect.inc/assets/chunked/initiate",
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([
[
'directory_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'size_bytes' => 123,
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.aspect.inc/assets/chunked/initiate"
payload := strings.NewReader("[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.aspect.inc/assets/chunked/initiate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aspect.inc/assets/chunked/initiate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"directory_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"size_bytes\": 123,\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n]"
response = http.request(request)
puts response.read_body[
{
"result": {
"asset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"asset_type": "video",
"asset_name": "<string>",
"chunk_size": 123,
"token": "<string>",
"token_expires_at": "2023-11-07T05:31:56Z"
},
"error": "<string>",
"skipped": true
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
