Publish large amounts of data through API

I need to send large amounts of data, probably several thousand bytes (each system will be different depending on the number of residents), from a web app to a photon, or boron with an SD card. I remember seeing a way to do this by wrapping the data in JSON or other ways, but I can’t find that information now. Is there a decent way to increase this over the 622 byte limit?

You could use the TCPClient to do a GET to your server to fetch the data: https://docs.particle.io/reference/device-os/firmware/photon/#tcpclient

The sample there shows how to do a basic GET request.

One issue is security … I’ve been searching everywhere but have NOT been able to locate a freely available HTTPS/TLS library that has been ported/tested on the Particle platforms. There is a port of the BearSSL library for Arduino here: https://github.com/arduino-libraries/ArduinoIoTCloudBearSSL

I use this all of the time … but haven’t tried the BearSSL port … yet. :wink:

1 Like

You didn't come across this library? Or does it not suite your needs? (granted it's not HTTPS)

1 Like

Nice! I had not yet found this!

This looks like it would work perfectly for creating your own HTTPS client.

Now I have something new to experiment with!

1 Like

@Humancell I’m not familiar with this at all, does this require the device to look for updates to the data? I would like to have a button on my UI to send data to each device after the customer adds new residents.

If the Photon or Boron is always powered, then you could use a Particle.function() to tell the device to fetch it's data. Sending it a command via this function could include the minimal details on what to fetch, and then you could write the HTTP(S) GET function to retrieve the data in the format that works best for you.

Does this make sense?

2 Likes

That makes sense, I think this should work. Thanks.