Making HTTP POST and Retrieving Data from HTTP POST


#1

I need some basic help to get started on making a HTTP POST to a url, and then retrieving the contents of the response data.

Can anyone help with:
How to initiate a connection to the net (SerialCloud.begin?)
How to make the HTTP POST call
How to retrieve the contents of the response

Thanks!


#2

Hey @michael,

How to initiate a connection to the net:

Here is an example taken from the Konekt Arduino IDE Hello World Example:

void setup() { /* note: we place println in setup(), NOT in loop() */
   SerialCloud.begin(115200);            /* Konekt Cloud     */
   SerialCloud.println("Hello, World!"); /* one-time message */
}

How to make the HTTP POST call:

You can take a look at the Konekt Cloud Webhooks Documentation for further information.

Essentially, you will login to https://dashboard.konekt.io, proceed to the Topics page, add a Custom Webhook app, and configure the routing rule to match on the _SIMPLESTRING_ topic; there, you will be able to enter the URL of your server that you wish to POST the data to.


How to retrieve the contents of the response:

When utilizing the Konekt Cloud, the HTTP response is not sent to the device; instead, a REST API call is utilized to send inbound data to the device (which will be available very soon, but is not yet available at the time of this writing).

We will also in the future support ways to perform direct HTTP connections from the Dash and Dash Pro, but there are limitations when not utilizing the Konekt Cloud.


Hope this helps,
PFW


#3

Thanks Pat

What I am looking for is making a HTTP POST directly from the Dash to my own web service, and then I want to use the response on the device.


#4

Can the Dash do an http post to something other than Konekt.io?


#5

I see in the original response that there was not yet a way to get inbound data to the device. Is there a way to do this now? I am also looking to make an HTTP post to my server to retrieve some information. I see that using hooks i can route a request to my server, but how do i get the response in the dash module?


#6

Currently you can only send data to your Dash through SMS. Through our API you can send an SMS, http://docs.hologram.apiary.io/#reference/sms/incoming-sms-to-device/send-an-sms-to-a-device


#7

Thanks! That will work for some items for me. Is there a plan in the near future to allow us to return data to the units? In my application I would like to be able to send small MIDI files to my device down the road.


#8

Yes! It is on our roadmap. Should be available soon.


#9

Awesome. Thanks! : )


#10

Any news on this front? I see some stuff mentioned about Direct IP. Seems like this would be what is needed, send a request directly to my site and get the response. Could not find information on how this is done though, just saw it mentioned in communication protocols.


#11

Looking more at that communication protocol section i notice that Direct IP and Spacebridge has a “NO” for available on Dash, so I am guessing that means we cannot do this still? But i have found a post with firmware allowing me to bypass and give commands directly to the U-Blox part, so maybe that is my only option at this point so send and receive HTTP data?


#12

Hi - We recently released inbound messaging functionality for the Dash that allows you to open a port for sending inbound data to the Dash. You can read more up on the functions here:
https://hologram.io/docs/reference/dash/api/#hologramcloud-listen-port-
Also, the latest example sketch in the Arduino IDE includes a full example of how to use the handler functions.
hologram_dash_cloud.ino

Hope these help! Let us know if you have any questions.


#13

That’s great, thank you! I will try this out : )