Add Images
curl --request POST \
--url https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"image_url": "<string>",
"reference_id": "<string>",
"metadata": {}
}
],
"update": false
}
'import requests
url = "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append"
payload = {
"items": [
{
"image_url": "<string>",
"reference_id": "<string>",
"metadata": {}
}
],
"update": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [{image_url: '<string>', reference_id: '<string>', metadata: {}}],
update: false
})
};
fetch('https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append', 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.scale.com/v1/nucleus/dataset/{dataset_id}/append",
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([
'items' => [
[
'image_url' => '<string>',
'reference_id' => '<string>',
'metadata' => [
]
]
],
'update' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.scale.com/v1/nucleus/dataset/{dataset_id}/append"
payload := strings.NewReader("{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.scale.com/v1/nucleus/dataset/{dataset_id}/append")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}"
response = http.request(request)
puts response.read_body{
"dataset_id": "ds_c6ka7tfaypgg05rf2ts0",
"new_items": 1,
"updated_items": 0,
"ignored_items": 0,
"rows": [
{
"data_id": "di_c6m14zv4gt3g060pwsz0",
"metadata": {
"foo": "bar"
}
}
]
}2D Data
Add Images
POST
/
dataset
/
{dataset_id}
/
append
Add Images
curl --request POST \
--url https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"image_url": "<string>",
"reference_id": "<string>",
"metadata": {}
}
],
"update": false
}
'import requests
url = "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append"
payload = {
"items": [
{
"image_url": "<string>",
"reference_id": "<string>",
"metadata": {}
}
],
"update": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [{image_url: '<string>', reference_id: '<string>', metadata: {}}],
update: false
})
};
fetch('https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append', 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.scale.com/v1/nucleus/dataset/{dataset_id}/append",
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([
'items' => [
[
'image_url' => '<string>',
'reference_id' => '<string>',
'metadata' => [
]
]
],
'update' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.scale.com/v1/nucleus/dataset/{dataset_id}/append"
payload := strings.NewReader("{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.scale.com/v1/nucleus/dataset/{dataset_id}/append")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/append")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"image_url\": \"<string>\",\n \"reference_id\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"update\": false\n}"
response = http.request(request)
puts response.read_body{
"dataset_id": "ds_c6ka7tfaypgg05rf2ts0",
"new_items": 1,
"updated_items": 0,
"ignored_items": 0,
"rows": [
{
"data_id": "di_c6m14zv4gt3g060pwsz0",
"metadata": {
"foo": "bar"
}
}
]
}Click for Python SDK
Dataset.append(
items: List[DatasetItem],
update: bool = False
) -> AsyncJob
Dataset can be populated with labeled and unlabeled data. Using Nucleus, you can filter down the data inside your dataset using custom metadata about your images.
For instance, your local dataset may contain Sunny, Foggy, and Rainy folders of images. All of these images can be uploaded into a single Nucleus Dataset, with added metadata like {"weather": "Sunny"}.
To update an item’s metadata, you can re-ingest the same items with the update argument set to true. Existing metadata will be overwritten for DatasetItems in the payload that share a reference_id with a previously uploaded DatasetItem. To retrieve your existing reference_ids, see Get Dataset Items.
The asynchronous endpoint returns an AsyncJob object that can sleep until complete, return current status, or return errors. There are two stages: first the metadata for the images is pulled into a reupload queue. Then the images are processed in batches of 3000. During this phase, the status will be updated every 3000 images.Authorizations
Body
application/json