Add new data

Add a new data item. You can add a maximum of 10000 files directly through this API. Use addOrganizationDataFile to add additional files.

This API requires multipart form data to be posted. This is how you call the API in a variety of languages:

import requests
ORGANIZATION_ID = 1
API_KEY = 'ei_...'
r = requests.post(
    'https://studio.edgeimpulse.com/v1/api/organizations/' + ORGANIZATION_ID + '/data/add',
    headers={
        'x-api-key': API_KEY
    },
    files=(
        ('name', (None, 'data item name')),
        ('dataset', (None, 'dataset')),
        ('metadata', (None, '{\"key\":\"value\"}')),
        ('bucketName', (None, 'Internal datasets')),
        ('files[]', ('hello.txt', open('/Users/janjongboom/Downloads/hello.txt', 'rb'), 'text/plain')),
        ('files[]', ('world.png', open('/Users/janjongboom/Downloads/world.png', 'rb'), 'image/png')),
    )
)
print('request returned', r, r.content)
curl -X POST -H \"x-api-key: ei_YOUR_API_KEY\" \\
    https://studio.edgeimpulse.com/v1/api/organizations/ORGANIZATION_ID/data/add \\
    -F bucketName=\"Internal datasets\" \\
    -F dataset=\"dataset\" \\
    -F name=\"data item name\" \\
    -F metadata='{\"key\":\"value\"}' \\
    -F files[]=@/Users/janjongboom/Downloads/hello.txt -F files[]=@/Users/janjongboom/Downloads/world.png
const request = require('request');
const fs = require('fs');
const ORGANIZATION_ID = 1;
const API_KEY = 'ei_...';
// Make the request with an empty 'formData' object, so we can manipulate this later
let req = request.post(`https://studio.edgeimpulse.com/v1/api/organizations/${ORGANIZATION_ID}/data/add`, {
    headers: {
        'Content-Type': 'multipart/form-data',
        'x-api-key': API_KEY
    },
    formData: { }
}, (_err, resp, body) => {
    if (_err) {
        return console.error('Error when doing request', _err);
    }
    else if (resp.statusCode !== 200) {
        return console.error('statusCode was not 200, but ' + resp.statusCode);
    }
    else {
        console.log('Request succeeded', body);
    }
});
// the request actually gets sent at the next tick so we can still manipulate this
let form = req.form();
form.append('name', 'data item name');
form.append('dataset', 'dataset');
form.append('bucketName', 'Internal datasets');
form.append('metadata', JSON.stringify({
    key: 'value',
}));
form.append('files[]', fs.readFileSync('/Users/janjongboom/Downloads/hello.txt'), {
    contentType: 'text/plain',
    filename: 'hello.txt'
});
form.append('files[]', fs.readFileSync('/Users/janjongboom/Downloads/world.png'), {
    contentType: 'image/png',
    filename: 'world.png'
});
Language
Authorization
Click Try It! to start a request and see the response here!