Start sampling

Start sampling

Start sampling on a device. This function returns immediately. Updates are streamed through the websocket API.

POSThttps://studio.edgeimpulse.com/v1/api/{projectId}/device/{deviceId}/start-sampling
Path parameters
projectId*integer

Project ID

deviceId*string

Device ID

Body
label*string

Label to be used during sampling.

lengthMs*integer

Requested length of the sample (in ms).

category*enum

Which acquisition category to sample data into.

trainingtestinganomaly
intervalMs*number

Interval between samples (can be calculated like 1/hz * 1000)

sensorstring

The sensor to sample from.

Response

OK

Body
success*boolean

Whether the operation succeeded

errorstring

Optional error description (set if 'success' was false)

idinteger
Request
const response = await fetch('https://studio.edgeimpulse.com/v1/api/{projectId}/device/{deviceId}/start-sampling', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "label": "text",
      "category": "training",
      "intervalMs": 0
    }),
});
const data = await response.json();
Response
{
  "success": false,
  "error": "text"
}

Last updated