Preview samples for AI Actions
curl --request POST \
--url https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"saveConfig": true,
"maxDataPreviewCount": 123,
"dataMetadataKey": "<string>",
"dataMetadataValue": "<string>"
}
'import requests
url = "https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples"
payload = {
"saveConfig": True,
"maxDataPreviewCount": 123,
"dataMetadataKey": "<string>",
"dataMetadataValue": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
saveConfig: true,
maxDataPreviewCount: 123,
dataMetadataKey: '<string>',
dataMetadataValue: '<string>'
})
};
fetch('https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples', 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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples",
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([
'saveConfig' => true,
'maxDataPreviewCount' => 123,
'dataMetadataKey' => '<string>',
'dataMetadataValue' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples"
payload := strings.NewReader("{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"samples": [
{
"id": 2,
"filename": "idle01.d8Ae",
"signatureValidate": true,
"created": "2023-11-07T05:31:56Z",
"lastModified": "2023-11-07T05:31:56Z",
"category": "training",
"coldstorageFilename": "<string>",
"label": "healthy-machine",
"intervalMs": 16,
"frequency": 62.5,
"originalIntervalMs": 16,
"originalFrequency": 62.5,
"deviceType": "<string>",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"added": "2023-11-07T05:31:56Z",
"boundingBoxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123
}
],
"isDisabled": true,
"isProcessing": true,
"processingError": true,
"isCropped": true,
"projectId": 123,
"sha256Hash": "<string>",
"datastreams": [
{
"index": 123,
"intervalMs": 123,
"frequencyHz": 123,
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"totalLengthMs": 123,
"imageDimensions": {
"width": 123,
"height": 123
}
}
],
"signatureMethod": "HS256",
"signatureKey": "<string>",
"deviceName": "<string>",
"totalLengthMs": 123,
"thumbnailVideo": "<string>",
"thumbnailVideoFull": "<string>",
"processingJobId": 123,
"processingErrorString": "<string>",
"metadata": {},
"projectOwnerName": "<string>",
"projectName": "<string>",
"structuredLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"structuredLabelsList": [
"<string>"
],
"createdBySyntheticDataJobId": 123,
"imageDimensions": {
"width": 123,
"height": 123
},
"videoUrl": "<string>",
"videoUrlFull": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
},
"lastUpdatedBy": {
"type": "user",
"id": 123
}
}
],
"totalCount": 123,
"error": "<string>"
}Preview samples for AI Actions
Get a number of random samples to show in the AI Actions screen. If saveConfig is passed in, then a valid actionId is required in the URL. If you don’t need to save the config (e.g. when creating a new action), you can use -1.
POST
/
api
/
{projectId}
/
ai-actions
/
{actionId}
/
preview-samples
Preview samples for AI Actions
curl --request POST \
--url https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"saveConfig": true,
"maxDataPreviewCount": 123,
"dataMetadataKey": "<string>",
"dataMetadataValue": "<string>"
}
'import requests
url = "https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples"
payload = {
"saveConfig": True,
"maxDataPreviewCount": 123,
"dataMetadataKey": "<string>",
"dataMetadataValue": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
saveConfig: true,
maxDataPreviewCount: 123,
dataMetadataKey: '<string>',
dataMetadataValue: '<string>'
})
};
fetch('https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples', 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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples",
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([
'saveConfig' => true,
'maxDataPreviewCount' => 123,
'dataMetadataKey' => '<string>',
'dataMetadataValue' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples"
payload := strings.NewReader("{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://studio.edgeimpulse.com/v1/api/{projectId}/ai-actions/{actionId}/preview-samples")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"saveConfig\": true,\n \"maxDataPreviewCount\": 123,\n \"dataMetadataKey\": \"<string>\",\n \"dataMetadataValue\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"samples": [
{
"id": 2,
"filename": "idle01.d8Ae",
"signatureValidate": true,
"created": "2023-11-07T05:31:56Z",
"lastModified": "2023-11-07T05:31:56Z",
"category": "training",
"coldstorageFilename": "<string>",
"label": "healthy-machine",
"intervalMs": 16,
"frequency": 62.5,
"originalIntervalMs": 16,
"originalFrequency": 62.5,
"deviceType": "<string>",
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"added": "2023-11-07T05:31:56Z",
"boundingBoxes": [
{
"label": "<string>",
"x": 123,
"y": 123,
"width": 123,
"height": 123
}
],
"isDisabled": true,
"isProcessing": true,
"processingError": true,
"isCropped": true,
"projectId": 123,
"sha256Hash": "<string>",
"datastreams": [
{
"index": 123,
"intervalMs": 123,
"frequencyHz": 123,
"sensors": [
{
"index": 123,
"name": "accX",
"units": "<string>"
}
],
"valuesCount": 123,
"totalLengthMs": 123,
"imageDimensions": {
"width": 123,
"height": 123
}
}
],
"signatureMethod": "HS256",
"signatureKey": "<string>",
"deviceName": "<string>",
"totalLengthMs": 123,
"thumbnailVideo": "<string>",
"thumbnailVideoFull": "<string>",
"processingJobId": 123,
"processingErrorString": "<string>",
"metadata": {},
"projectOwnerName": "<string>",
"projectName": "<string>",
"structuredLabels": [
{
"startIndex": 123,
"endIndex": 123,
"label": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
}
}
],
"structuredLabelsList": [
"<string>"
],
"createdBySyntheticDataJobId": 123,
"imageDimensions": {
"width": 123,
"height": 123
},
"videoUrl": "<string>",
"videoUrlFull": "<string>",
"labelMap": {
"type": "key-values",
"labels": {}
},
"lastUpdatedBy": {
"type": "user",
"id": 123
}
}
],
"totalCount": 123,
"error": "<string>"
}Authorizations
ApiKeyAuthenticationJWTAuthenticationJWTHttpHeaderAuthenticationOAuth2
Body
application/json
If this is passed in, the previewConfig of the AI action is overwritten (requires actionId to be a valid action).
Type of data to preview. A random subset of this data will be returned.
Available options:
allData, unlabeledData, enabledData, dataWithoutMetadataKey, dataWithMetadata Max. amount of data items to return.
Metadata key to filter on. Required if dataCategory is equal to "dataWithoutMetadataKey" or "dataWithMetadata".
Metadata value to filter on. Required if dataCategory is equal to "dataWithMetadata".
Was this page helpful?
⌘I