Http Get request


#1

Excuse my ignorance, I’m new to all this webhook stuff. I have project running at the moment using a sim800 module that grabs data from a web api with a http get request. There are plans to build a few more of these devices and I would like to upgrade them to lte and to use hologram to make management easier (sending out status emails etc). Is there anyway to route a http get request to and from the devices via the custom web hooks or is only post supported? Will get ever be supported?

Dave


#2

I think you are confusing things. Outgoing requests Device originated requests (ie SIM800 requesting data from a 3rd party API can support any protocol / request method.

If you use Hologram cloud to send data to a device, it involves a middleman. The process is

  1. Some resource / code on your computer sends a POST request to hologram cloud
  2. Hologram cloud servers do some magic to identify the device you specified and either a. attemps to open a TCP connection to your device or b. sends a UDP datagram to your device.
  3. Your device must have either a listening TCP or UDP socket at a specified port. It will then receive the data payload.

It is important that this is not HTTP and there is no HTTP headers or GET / POST. This is a lower level (OSI Layer 4). This is good as there is much less overhead as you dont have to send kB of HTTP headers to communicate, but more difficult in that you may have to use some custom data schema. Note that cellular connected devices are not directly addressable from the internet (without using spacebridge and a proxy).

So in summary there is no POST or GET going to the device, only a TCP datastream or UDP datgarams.


#3

Thanks for the quick rely, I certainly am confused, more so now I think. So if I have a 3rd part API that currently my device provides with a URL containing a number of filter options using a http get and that API returns some JSON formatted data, is there any way to have that transaction occur via Hologram cloud and if so is there some docs I can read explaining how to do it? I had thought if I used the webhook builder to create a route that took the data from a message from the device it would then send the request to the api, get the data from the api and I could then send that back to the device. That almost seems to work except that the webhook makes a post request to the api which it doesn’t like.

Cheers
Dave


#4

Ah, ok, I see what you are trying to do.

The quick answer to just have the SIM800 talk to your API directly and dont use hologram webhooks / data routing. What you are looking to do is not what data routing is for.

Hologram Data Routing
The most common use for M2M simcards is data collection. Things like asset trackers that send a server their location and maybe some sensor data, weather stations that send temperature and pressure at intervals, etc. Data tends to heavily go Device–>Cloud with much rarer data from Cloud–> Device, mostly for software updates and occasional commands.

The data routing is a way to provide an endpoint appropriate for low power embedded systems over high cost (relatively) data links while being able to send data to more advanced endpoints. Its use is solely Device–>Cloud, not Cloud–>Device.

This is useful since you can send Hologram’s data router an unencrypted 20-byte message, pay for 20-bytes of data (+~500bytes of TCP overhead) and Hologram will translate that into a 5kB HTTPS request to some 3rd party storage engine such as Amazon S3, or anything else you want. This is good for 2 reasons

  1. Hologram data is pretty cheap, but still like 5,000x more expensive than data once you are hardwired to the internet. For example AWS charges $0.09/GB for data leaving their system where Hologram charges $400/GB (at their on-demand rate).
  2. Cellular connected devices tend to have low CPU power and often cannot handle the required encryption algorithms for HTTPS and other secure protocols that clouds tend to require.

Since the purpose of the data router is to collect data, the only response it sends back to the Device is basically that it accepted the data sent to it and closes the connection. This is good as your device can successfully deliver data without having to wait for the processing and handshaking between Hologram’s cloud and the 3rd party API but it means your device does not get any data back from the API.

The reason hologram’s webhook is using POST (this is configurable by the way, atleast in the advanced webhook) is again that is more the purpose of the the data router, to POST data collected by the Device to an API for storage / analysis / aggregation / etc.

What you are trying to do
It sounds like you aren’t trying to deliver data from your device to some cloud service but instead are trying to request data for your device to use. The important data is the JSON response from this 3rd party API. In that case you should use the SIM800 HTTP Library and query the API directly. Dont use the Hologram data router as it is not designed to be a proxy in between cell devices and API’s, there are no mechanisms to send data back to the device.

Does that make sense?


Project interfacing with AWS
#5

Thank you for the detailed reply, it clears everything up nicely. Hologram just looked cool because other than the get request the machine does all the other communication it does it sending out status reports (low battery etc) and logging which looked a lot easier to handle using Hologram. I am sure I’ll find another use for the sim and service.

Cheers
Dave


closed #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.