New ingestion API
The ingestion service is used to send new device data to Edge Impulse. It's available on both HTTP and HTTPS endpoints, and requires an API key to authenticate.
With the ingestion service, you can upload the following types of files:
There are three endpoints available:
  • POST /api/training/files - for gathering training data.
  • POST /api/testing/files - for gathering testing data. If you have the 'Live classification' page open in your browser the file will automatically be classified against the current impulse.
  • POST /api/anomaly/files - for anomaly data from deployed devices.
The API is located at:
HTTP
http://ingestion.edgeimpulse.com
HTTPS
https://ingestion.edgeimpulse.com

Header Parameters

  • x-api-key - API Key (required).
  • x-label - Label (optional). If this header is not provided a label is automatically inferred from the filename through the following regex: ^[a-zA-Z0-9\s-_]+. For example: idle.01 will yield the label idle.
  • x-disallow-duplicates - When set, checks the hash of the message against your current dataset (optional). We'd recommend to set this header, but haven't enabled it by default for backwards compatibility.
  • x-add-date-id: 1 - to add a date ID to the filename. E.g. if you upload with filename test.wav the file name will be test - set this option and we'll add a unique ID to the end (this is what we use on the daemon for example to create unique names).
  • Content-type - format of data used. Can be application/cbor, application/json, multipart/form-data if implementing multipart requests.

Response

All responses are sent with content type text/plain. The following response codes may be returned:
  • 200 - Stored the file, file name is in the body.
  • 400 - Invalid message, e.g. fields are missing, or are invalid. See body for more information.
  • 401 - Missing x-api-key header, or invalid api key.
  • 421 - Missing header, see body for more information.
  • 500 - Internal server error, see body for more information.

Example Usage

cURL
Python
Node.js
curl -X POST \
-H "x-api-key: ei_238fae..." \
-H "x-label: car" \
-H "Content-Type: multipart/form-data" \
http://ingestion.edgeimpulse.com/api/training/files
# Install requests via: `pip3 install requests`
import requests
headers = {
'x-api-key': 'ei_238fae...',
'x-label': 'car',
}
files = [
('data', open('one.png', 'rb')),
('data', open('two.png', 'rb')),
]
res = requests.post('http://ingestion.edgeimpulse.com/api/training/files', headers=headers, files=files)
if (res.status_code == 200):
print('Uploaded file(s) to Edge Impulse\n', res.status_code, res.content)
else:
print('Failed to upload file(s) to Edge Impulse\n', res.status_code, res.content)
import fetch, { FormData, fileFromSync } from 'node-fetch';
const form = new FormData();
form.append('data', fileFromSync('one.png'));
form.append('data', fileFromSync('two.png'));
fetch('http://ingestion.edgeimpulse.com/api/training/files', {
method: 'POST',
headers: {
'x-api-key': 'ei_238fae...',
'x-label': 'car',
'Content-Type': 'multipart/form-data'
},
body: form
});
Export as PDF
Copy link