Cloud-to-device Azure IoT REST API - rest

I explored on sending data from Device to Cloud using Azure REST Apis. It is working seamlessly without any issues. I'm not finding good articles on sending Cloud-to-Device messages to Arduino board using "Azure IoT Hub REST Apis". Could some one provide suggestions on this

You could also send the request as the azure portal does it. All C2D from AZ Portal are sent through this Endpoint https://main.iothub.ext.azure.com/api/Service/SendMessage/ and the payload is a json that look like this:
{
"hostName": "iothub-hostname",
"owner": "twinUpdate",
"key": "key for the iothub",
"deviceID": "your device on that hub",
"body": "{\"test\": \"This is a test over postman\"}",
"properties": "[]"
}
Keep in mind that you need to add an Authorization Header with valid Bearer token. You can get this when you log in to AZ Portal.

As Peter Pan said, there isn't a RESTful API for send C2D messages currently. However, you still have some other chooses.
Use Azure Function App. You can create a HTTP trigger Azure Function App to use as RESTful proxy, and run IoT Hub SDK on Azure Function App to send C2D messages.
Use AMQP over WebSockets with 443 port if you cannot use 5671 port for AMQP to connect to IoT Hub on your service side. We have developed a web based IoT Hub devtool based on Rhea, and you can reference our code.

According to the offical document Send and receive messages with IoT Hub, and after I reviewed the source codes of Azure IoT Hub for sending cloud-to-device message using different languages, there is no REST API to support on sending Cloud-to-Device messages. To send c2d message from application to Azure IoT Hub, the recommended protocol is AMQP and the simple way is using Azure IoT Hub SDK. That you can refer to the section Communication protocol, as below.
However, if you want to receive the c2d message from Arduino, you can refer to the section Cloud-to-device messages and use the REST API Receive Device Bound Notification on Arduino.

Related

can I recover any data from a device and send it to the ibm watson iot platform cloud?

Good morning everyone,
I am currently working on a project which I use IBM Watson IoT Platform which will be linked with a Gateway,
Can I retrieve any parameter from the Gateway (ex: SSID, Password ...) and send it to the IBM Watson IoT Platform or I can only send an event triggered by the Gateway
Knowing that I use the MQTT protocol to send events to the IBM Watson IoT Platform
Command messages can be sent to gateways through the platform using MQTT to e.g. tell the gateway what data to send.
Code would have to be running on the gateway that listened for these commands and returned the information requested in the form of events (MQTT messages).

How to invoke an OpenWhisk action from IoT Platform in Bluemix

We would like to know how to invoke an OpenWhisk action from IoT Platform in Bluemix. What we want to accomplish is:
Send an event data from a device to IoT Platform
Subscribe the event
Call an OpenWhisk action.
We are assuming the event data is JSON format. We know we can develop an application that subscribes to an event on the IoT Platform like: https://console.bluemix.net/docs/services/IoT/applications/libraries/java.html#java. However, we believe that there must be a more simpler way.
If we look at IoT Platform, we can create an action such as IFTTT, Webhook action, Forward event to cloud, etc. Generally speaking, which way do you recommend to invoke an OpenWhisk action from IoT Platform?
Any comments or suggestions must be appreciated. Thank you.
IBM Message Hub can automatically bridge messages between the Watson IoT platform and OpenWhisk.
Watson IoT service provides an integration to forward all incoming topics messages to IBM Message Hub. IBM Message Hub is an Apache Kafka-as-a-Service offering on IBM Bluemix.
Here are the instructions for connecting and configuring a historian service for the Watson IoT platform using IBM Message Hub.
https://console.bluemix.net/docs/services/IoT/message_hub.html#messagehub_main
OpenWhisk has a trigger feed service for IBM Message Hub. You can have triggers subscribe to messages from a Message Hub topic. Actions can then be bound to triggers to fire automatically for each event.
Here's an example walking you through connecting an OpenWhisk action to the Message Hub topic:
https://github.com/IBM/openwhisk-message-hub-trigger

Missing notification hub device registrations

There were recently some issues with the availability of Azure Notification Hubs. While the service is back online now, multiple users have registered with our app in the meantime. These users have tags registered in our db, but it seems those tags are not registered with the actual Notification Hub.
How do I handle device registrations that came in to my service during Azure Notification Hub outage?
You can use Azure Notification Hubs server side SDK. Registering for Notifications using the WebAPI Backend is an example of how to do that.

How to expose existing REST API through Azure Service Bus (or through something else)

I have an existing on-premise REST API from an external vendor. I'd like to expose this API unmodified to the outside world through an Azure website. So I have customers that run this API on-premise and I'm developing a PaaS/SaaS app that should access these on-premise API's.
I also have a client SDK from the external vendor that calls the API. Works without issues when running on-premise. However, now I want to use this SDK from my Azure website.
How do I route REST service calls generated by the SDK to the on-premise API? I thought about using Azure Service Bus WebHttpRelayBinding but this seems to require a WCF contract which I do not have.
In other words: is there a way to send unmodified HTTP traffic to an on-premise system from Azure (through Azure Service Bus or by any other means)?
If you want to access an On-Premise service from the Azure service/websites what you need is a Hybrid Connection.
For that you will need a BizTalk service to redirect the trafic to your on-prem service.
Here are the steps to how to setup a Hybrid connection:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-get-started/

Does Service Bus for Windows Server (Service Bus 1.0 Beta) support REST API?

IF support where can i find detail documentation about REST api.
Thanks
THanks for the reply and Update information about release version of service bus. i manage to sucessfully connect to the service bus and get the authentication token using following microsoft examples.
http://msdn.microsoft.com/en-us/library/windowsazure/jj193003%28v=azure.10%29.aspx
Once u get the token rest of operation (create que, send messages, recive messages) are same as windows azure service bus. please see the detail about microsoft documentation about service bus operation.
http://msdn.microsoft.com/en-us/library/windowsazure/hh690927.aspx
hope this helpful.
THanks.
The protocol surface between Server and Service is largely symmetric, albeit there are different ports for some sub-services and the authentication model has been adapted for a Server environment using a local STS instead of ACS. You will find updated MSDN documentation beyond what's currently available as part of the SDK as we ship the release version of Service Bus Server, which will happen before this month is over.