Add a dataset item
Post https://api.app.labelf.ai/v2/dataset/{YOUR_DATASET_ID}/item
This endpoint allows you to do inference on a single model that you have deployed. Max 8 texts per call.
Response format
JSON
Authentication
Yes - Bearer token
Example cURL request
import requests
# Replace with your bearer token
bearer_token = ""
dataset_id = 1337
headers = {
'Authorization': f'Bearer {bearer_token}',
}
# Make sure to replace column1, column2 etc. with your actual column names from the dataset.
# Any column names that are not in the dataset will be ignored,
# and any columns that are in the dataset but not in the payload will be set to null.
json_data = {
"rows": [
{
"column1": "2022-01-18T15:03:49Z",
"column2": "some text",
"column3": "some more text",
"column4": 5959
},
{
"column1": "2022-02-12T18:12:39Z",
"column2": "some other text",
"column3": "some cool text",
"column4": 5960
}
]
}
def add_item(payload, dataset_id):
response = requests.post(
f'https://api.app.labelf.ai/v2/dataset/{dataset_id}/item', headers=headers, json=payload)
return response
response = add_item(json_data, dataset_id)
print(response.json())
fetch("https://api.app.labelf.ai/v2/dataset/YOUR_DATASET_ID/item", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_BEARER_TOKEN",
"Content-Type": "application/json",
},
// Replace texts with your own texts, max 8 text items in the texts array
body: JSON.stringify({
"rows": [
{
"column1": "2022-01-18T15:03:49Z",
"column2": "some text",
"column3": "some more text",
"column4": 5959
},
{
"column1": "2022-02-12T18:12:39Z",
"column2": "some other text",
"column3": "some cool text",
"column4": 5960
}
]
}),
});
curl --location --request POST 'https://api.app.labelf.ai/v2/dataset/YOUR_DATASET_ID/item' \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{ \
"rows": [ \
{ \
"column1": "2022-01-18T15:03:49Z", \
"column2": "some text", \
"column3": "some more text", \
"column4": 5959 \
},
{
"column1": "2022-02-12T18:12:39Z", \
"column2": "some other text", \
"column3": "some cool text", \
"column4": 5960 \
} \
] \
}' \
Example response
HTTP/1.1 200 OK
Status: 200 OK
Content-Type: application/json;
charset=utf-8
...
{
"status": "success"
}
Change Cookie Settings