Datasets
Add Dataset Row
Create a new dataset item in the specified dataset
POST
/
datasets
/
{slug}
/
items
Create a dataset item
curl --request POST \
--url https://api.getbasalt.ai/datasets/{slug}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
}
'import requests
url = "https://api.getbasalt.ai/datasets/{slug}/items"
payload = {
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
}
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({
values: {columnName1: 'value1', columnName2: 'value2'},
name: 'Test case 1',
idealOutput: 'This is the expected output',
metadata: {source: 'api', context: 'testing'}
})
};
fetch('https://api.getbasalt.ai/datasets/{slug}/items', 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.getbasalt.ai/datasets/{slug}/items",
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([
'values' => [
'columnName1' => 'value1',
'columnName2' => 'value2'
],
'name' => 'Test case 1',
'idealOutput' => 'This is the expected output',
'metadata' => [
'source' => 'api',
'context' => 'testing'
]
]),
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.getbasalt.ai/datasets/{slug}/items"
payload := strings.NewReader("{\n \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\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.getbasalt.ai/datasets/{slug}/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbasalt.ai/datasets/{slug}/items")
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 \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\n }\n}"
response = http.request(request)
puts response.read_body{
"datasetRow": {
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
},
"warning": "The following columns do not exist in the dataset and were omitted: extraColumn1, extraColumn2"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The slug of the dataset to add an item to
Example:
"my-dataset"
Body
application/json
The values for each column in this dataset row
Show child attributes
Show child attributes
Example:
{
"columnName1": "value1",
"columnName2": "value2"
}
The name of the dataset row
Example:
"Test case 1"
The ideal output for this dataset row, if any
Example:
"This is the expected output"
Additional metadata for this dataset row
Show child attributes
Show child attributes
Example:
{ "source": "api", "context": "testing" }
Response
The created dataset item
Was this page helpful?
⌘I
Create a dataset item
curl --request POST \
--url https://api.getbasalt.ai/datasets/{slug}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
}
'import requests
url = "https://api.getbasalt.ai/datasets/{slug}/items"
payload = {
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
}
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({
values: {columnName1: 'value1', columnName2: 'value2'},
name: 'Test case 1',
idealOutput: 'This is the expected output',
metadata: {source: 'api', context: 'testing'}
})
};
fetch('https://api.getbasalt.ai/datasets/{slug}/items', 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.getbasalt.ai/datasets/{slug}/items",
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([
'values' => [
'columnName1' => 'value1',
'columnName2' => 'value2'
],
'name' => 'Test case 1',
'idealOutput' => 'This is the expected output',
'metadata' => [
'source' => 'api',
'context' => 'testing'
]
]),
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.getbasalt.ai/datasets/{slug}/items"
payload := strings.NewReader("{\n \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\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.getbasalt.ai/datasets/{slug}/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getbasalt.ai/datasets/{slug}/items")
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 \"values\": {\n \"columnName1\": \"value1\",\n \"columnName2\": \"value2\"\n },\n \"name\": \"Test case 1\",\n \"idealOutput\": \"This is the expected output\",\n \"metadata\": {\n \"source\": \"api\",\n \"context\": \"testing\"\n }\n}"
response = http.request(request)
puts response.read_body{
"datasetRow": {
"values": {
"columnName1": "value1",
"columnName2": "value2"
},
"name": "Test case 1",
"idealOutput": "This is the expected output",
"metadata": {
"source": "api",
"context": "testing"
}
},
"warning": "The following columns do not exist in the dataset and were omitted: extraColumn1, extraColumn2"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}