Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Batch Data with JSON
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

Batch Data with JSON

by phillycheeseman on Tue Jan 26, 2021 8:54 am

I am using Particle.io which uses it's Webhook to 'Post' the JSON data to the Adafruit.io. So far so good!
Obfuscated example:
POST-- /api/v2/webhooks/feed/jyr2pTKPfeCT******bo9XWV
{
"name": "Fred-01-Celsius",
"data": "{ \"value\": \"20.75\", \"feedID\": \"jyr******PfeCTAx6pui3dqq****"}",
"ttl": 60,
"published_at": "2021-01-26T12:38:04.566Z",
"coreid": "e00fce6834d206c2d9b95805"
}

But I wanted to post multiple data points (for example 30 samples of temperature data) at once rather than 30 Webhooks calls to the server. The documentation if you are not using the Adafruit.io API is very sparse. I have tried many configurations - best I get is several variables in one entry. The Dashboard log shows:
(2021/01/25 6:35PM Fredd-01-Celsius ['25', '26'])

Can anyone help me understand how to form the JSON to post to Adafruit.iuo in batch form?

Also the URL for batch processing is a little unclear - I get a URL error when I append '/data/batch' to the address:
POST /api/v2/webhooks/feed/jyr******PfeCTAx6pui3dqq****/data/batch

Any help would be greatly appreciated. Thanks
philly

phillycheeseman
 
Posts: 12
Joined: Mon Oct 09, 2017 7:47 am

Re: Batch Data with JSON

by mikeysklar on Wed Jan 27, 2021 5:15 pm

Here is a start:

example batch posting URL format:

Code: Select all | TOGGLE FULL SIZE
https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data/batch


docs:
http://adafruit.github.io/io-api/#opera ... upFeedData

mikeysklar
 
Posts: 4207
Joined: Mon Aug 01, 2016 8:10 pm

Re: Batch Data with JSON

by phillycheeseman on Fri Jan 29, 2021 2:27 pm

Thanks a ton for your response.

I did see these docs and I have tried to connect with this URL format without success but I will reread your link and try again!

Cheers
philly

phillycheeseman
 
Posts: 12
Joined: Mon Oct 09, 2017 7:47 am

Please be positive and constructive with your questions and comments.