Confirm asset uploads and create the files
curl --request POST \
--url https://api.occtoo.com/v1/assets/{dataSourceId}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assets": [
{
"entryKey": "sku-1",
"filename": "front.jpg"
}
]
}
'import requests
url = "https://api.occtoo.com/v1/assets/{dataSourceId}/complete"
payload = { "assets": [
{
"entryKey": "sku-1",
"filename": "front.jpg"
}
] }
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({assets: [{entryKey: 'sku-1', filename: 'front.jpg'}]})
};
fetch('https://api.occtoo.com/v1/assets/{dataSourceId}/complete', 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.occtoo.com/v1/assets/{dataSourceId}/complete",
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([
'assets' => [
[
'entryKey' => 'sku-1',
'filename' => 'front.jpg'
]
]
]),
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.occtoo.com/v1/assets/{dataSourceId}/complete"
payload := strings.NewReader("{\n \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\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.occtoo.com/v1/assets/{dataSourceId}/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.occtoo.com/v1/assets/{dataSourceId}/complete")
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 \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"completed": {
"sku-1": {
"filename": "front.jpg",
"mimeType": "image/jpeg",
"size": 120432,
"publicUrl": "https://cdn.occtoo-media.com/6b1f0b3c-6f2e-4a52-9a1e-7c6f0c2f9a10/9c2a7d18-4f6b-4f0b-9a2a-2f2e6c7d8e90/front.jpg",
"width": 1200,
"height": 800
}
},
"failed": {}
}Assets API
Confirm asset uploads and create the files
Confirms the uploads and creates the files. At most 50 assets per call.
Occtoo reads each blob back, creates the media file and updates the data source entry behind the entry key. Each asset must carry the same filename it was initialized under — a different name points at a blob that doesn’t exist, and that entry key comes back under failed.
POST
/
v1
/
assets
/
{dataSourceId}
/
complete
Confirm asset uploads and create the files
curl --request POST \
--url https://api.occtoo.com/v1/assets/{dataSourceId}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assets": [
{
"entryKey": "sku-1",
"filename": "front.jpg"
}
]
}
'import requests
url = "https://api.occtoo.com/v1/assets/{dataSourceId}/complete"
payload = { "assets": [
{
"entryKey": "sku-1",
"filename": "front.jpg"
}
] }
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({assets: [{entryKey: 'sku-1', filename: 'front.jpg'}]})
};
fetch('https://api.occtoo.com/v1/assets/{dataSourceId}/complete', 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.occtoo.com/v1/assets/{dataSourceId}/complete",
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([
'assets' => [
[
'entryKey' => 'sku-1',
'filename' => 'front.jpg'
]
]
]),
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.occtoo.com/v1/assets/{dataSourceId}/complete"
payload := strings.NewReader("{\n \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\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.occtoo.com/v1/assets/{dataSourceId}/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.occtoo.com/v1/assets/{dataSourceId}/complete")
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 \"assets\": [\n {\n \"entryKey\": \"sku-1\",\n \"filename\": \"front.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"completed": {
"sku-1": {
"filename": "front.jpg",
"mimeType": "image/jpeg",
"size": 120432,
"publicUrl": "https://cdn.occtoo-media.com/6b1f0b3c-6f2e-4a52-9a1e-7c6f0c2f9a10/9c2a7d18-4f6b-4f0b-9a2a-2f2e6c7d8e90/front.jpg",
"width": 1200,
"height": 800
}
},
"failed": {}
}Authorizations
kindeOAuthbearerAuthapiKey
Path Parameters
Was this page helpful?