Error:500 {"success":false,"error":"No data found (in data form field)"}

Question/Issue:
I want to use the data ingestion service of Edge Impulse for training data. So, I am using JSONata to transform the data and route it to edge impulse. But upon using the following queries, I am getting error 500. I am not using any encoding format.
I did some trial and error to figure out the issue. I followed all steps as suggested in the Data Acquisition format and Ingestion Service guidelines.
I have set the URL correctly and added all the headers(tried both in JSON query and JSONata additional headers tab). But still, I get the following error 500 {“success”: false," error": “No data found (in data form field)”}
Project ID:
Blues_test - Data acquisition - Edge Impulse
Context/Use case:
Below is the query I am using to route the data:

{
    "protected": {
        "ver": "v1",
        "alg": "none",
        "iat": 1564128599
    },
    "signature": "0000000000000000000000000000000000000000000000000000000000000000", 
    "payload": {
        "device_name": "ac:87:a3:0a:2d:1b",
        "device_type": "DISCO-L475VG-IOT01A",
        "interval_ms": 10,
        "sensors": [
            { "name": "accX", "units": "m/s2" },
            { "name": "accY", "units": "m/s2" },
            { "name": "accZ", "units": "m/s2" }
        ],
        "values": body.values
    }
}

I have one more doubt: What should be the signature when the encoding type is none?
body. values have the array of data points from the accelerometer. I have tested routing with this JSON query to webhook. In this case, Endpoints and Additional Headers are being entered in the GUI.

I have also tried the following JSON query.

{
"method": "POST",
"headers": {
    "x-api-key": "ei_9d8a1db7e660cf3d0dd04d379a704cd560500b782f0c637884a55fdc1edf3501",
    "x-file-name": "test01",
    "Content-Type": "application/json"
  },
"body":
    {
        "protected": {
            "ver": "v1",
            "alg": "none",
            "iat": 1564128599
        },
        "signature": "0000000000000000000000000000000000000000000000000000000000000000", 
        "payload": {
            "device_name": "ac:87:a3:0a:2d:1b",
            "device_type": "DISCO-L475VG-IOT01A",
            "interval_ms": 10,
            "sensors": [
                { "name": "accX", "units": "m/s2" },
                { "name": "accY", "units": "m/s2" },
                { "name": "accZ", "units": "m/s2" }
            ],
            "values": body.values
        }
    },
"encoding": "none"
}

Thank you for your support! Eagerly waiting for the response.
Warm regards
Sobhit

No need for the signature when the alg is none, so the above one structure should work. However, I have never used JSONata and it is not clear what are you trying to do.

What format is your data? if it is in json then make it look like the format that we have in the studio and then convert it to cbor, either way json or cbor should work.

Also it would be interesting to see how JSONata is converting appending the data to the value array.

Best
Omar

Check my webhook page below: The issue is not getting resolved.

{
  "payload": {
    "device_name": "ac:87:a3:0a:2d:1b",
    "device_type": "DISCO-L475VG-IOT01A",
    "interval_ms": 10,
    "sensors": [
      {
        "name": "accX",
        "units": "m/s2"
      },
      {
        "name": "accY",
        "units": "m/s2"
      },
      {
        "name": "accZ",
        "units": "m/s2"
      }
    ],
    "values": [
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ]
  },
  "protected": {
    "alg": "none",
    "iat": 1564128599,
    "ver": "v1"
  },
  "signature": "0000000000000000000000000000000000000000000000000000000000000000"
}      

So one of the things I can see is that the values array is not closed correctly.
Check, there are two [ [ open and there is only one close ]

Hi Omar,

That’s right, but I have a double ending ‘]’ in the JSON received. It’s just that I missed it while copying it to the forum. Actually, I am transferring 100 values, and to shorten that data for understanding, I have shown 3 values. While doing this, I missed the ‘]’. So, I assure you that’s not the issue.

What else might be the cause? I want to know, what is the data form field? How do I know my device Id, the doc says it should be unique. Could you please also review my Blues_test Edge Impulse project? Do we need to set something there in the dashboard - like accelerometer data? (I think that is after the data is uploaded).

Warm regards
Sobhit

Okay, I understand, I am sure it should work without any issue if the structure of the JSON file is correct.
Can you send me or try to paste the entire JSON file that is failing? I will compare it with a working one and let you know what is causing the issue.

The JSON File I receive on Webhook is as follows.

{
  "payload": {
    "device_name": "ac:87:a3:0a:2d:1b",
    "device_type": "DISCO-L475VG-IOT01A",
    "interval_ms": 10,
    "sensors": [
      {
        "name": "accX",
        "units": "m/s2"
      },
      {
        "name": "accY",
        "units": "m/s2"
      },
      {
        "name": "accZ",
        "units": "m/s2"
      }
    ],
    "values": [
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ],
      [
        215,
        141126,
        476694
      ]
    ]
  },
  "protected": {
    "alg": "none",
    "iat": 1564128599,
    "ver": "v1"
  },
  "signature": "0000000000000000000000000000000000000000000000000000000000000000"
}

I want to know, what is the data form field?
How do I know my device Id? the doc says it should be unique.


The other configurations are also mentioned as above.

Warm regards
Sobhit

@Sobhit25 Post to /api/training/data instead. The /files endpoint expects multipart form data instead (with a files[] object). To /data you can just post a JSON file in the body.

Example in Node:

const request = require('request');
const fs = require('fs');

request({
    method: 'POST',
    uri: 'https://ingestion.edgeimpulse.com/api/training/data',
    headers: {
        'x-api-key': 'ei_....',
        'x-file-name': 'test.json',
        'Content-Type': 'application/json',
    },
    body: fs.readFileSync('test-sample.json')
}, (err, res, body) => {
    console.log('err', err, 'res', res.statusCode, 'body', body);
})
3 Likes