HTTP POST REST Sample code?


#1

Folks, I’ve had a couple of spark cores for a little while now and over the past few days have dusted them off. Not sure if I am missing something, but looking for an example that shows/explains how to do a HTTP POST against a Rest Service using a JSON payload? If have read quite a few posts talking about the past issues, response times, disconnects, etc…but do not see anything of late on how to do it? I also checked the introductory tutorials, but not of them seem to cover it. My assumption is that I am missing something here, can someone point me in the right direction?


#2

I found some sample code and now it seems to work 1 out of every 100 tries…I have updated and listed the code here:


scott


#3

Hi Scott,
I would use webhooks, I use them in all my projects. Please check the documentation here.
They are powerful and relatively simple to use.

EDIT: few examples:
https://www.hackster.io/gusgonnet/pushing-data-to-google-docs-02f9c4 -> check section STEP 1: the webhook
https://www.hackster.io/gusgonnet/sharing-the-push-notifications-of-your-hardware-b558ae -> section Add the particle webhook

If you have questions post back!
Gustavo.


#4

Okay, I will investigate.
Thanks,