Web Service Response Data


#1

We have a requirement where the users have to authenticate via a web service before they can start using a machine. The Web Service is fairly simplistic which takes the device id and authentication key as the parameters and returns back either “true” or “false” indicating whether the user has access to machine or not.

Now my question is

  1. Is there a way to invoke a web service (REST API POST) from the device directly. Do you have a sample code for the same
  2. Just in case # 1 is not possible, we could potentially use HologramCloud.sendMessage and then configure a Data Route to use Advanced Web Hook Builder to post the message – however I cannot see a way to return back the value “true” or “false” from our API to the device.
  3. I am guessing the above could be achieved by either sending an SMS to the device OR sending a message from our web service to a device specific web-hook and within our HologramDash, we could listen to messages using HologramCloud.listen() to subscribe to events send from the cloud. Is there a best practice approach from your perspective considering that the user journey for authentication has to almost work instantaneously.
  4. Is there any other mechanism for getting access to the web service response data.

#2

Came across this looking to solve the same problem. This is exactly what we are looking for as well. Our use case is for configuration variables stored on a server. Thanks for any advice on this front!

Best,
Kevin


#3

So the Dash can’t POST to non-hologram servers right now but it’s something we’re thinking about.
In the meantime, you could do this in kind of a roundabout way by making a cloud data webhook on the dashboard and then have your webservice POST back to that when it gets an auth request. In your code on the Dash you would have to setup a listener and catch that message.


#4

Thanks for your response. I noticed that on the link https://hologram.io/docs/guide/cloud/message-to-device/, there is a note stating “The Hologram Dash does not support receiving cloud messages. You must use SMS to send data to the Dash”. This seems to be contradicting with your response

I am assuming that the above note is historical and no longer an issue because the sample code / sketch on github (hologram_dash_cloud) and there is code there which has a listener running on port 4444 and callbackFunction is registered using HologramCloud.attachHandlerInbound. Can you please clarify if this is approach that you are recommending.

Also can you please elaborate on the difference between the 2 REST APIs
https://dashboard.hologram.io/api/1/devices/messages and
https://dashboard.hologram.io/api/1/devices/messages/deviceid/webhookguid

Is there an advantage of using either of the API over the other - and can we send either of these REST API’s to send a message to Hologram Dash

Thanks
Nitesh


#5

Yeah that’s outdated. Thanks for pointing it out. We’ll get that fixed.
The code with the listener and callback is what I’m referring to.

The first endpoint allows you to send a message to one or more devices at a time using your API key or username and password as credentials and to any port on the devices.
The second one doesn’t require any extra credentials and has a port locked in, but only works on a single device at a time.

Both of those should work to send a message to the Dash.


#6

Thanks for the clarifications. Will try it out


#7

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