IoT Hub exposes REST APIs and SDKs to interact with it.
The fact is that production projects sometimes (often) require implementing intermediate layers (logic, security or whatever) between IoT Hub used features and project’s accessible endpoints. This can be done with custom SDKs or in a more service oriented approach, with applicative services (lastly, usually REST oriented).
You will find here a Visual Studio 2017 extension that creates REST APIS (.NET Core 2.1.x) solutions exposing IoT Hub features. Indeed, the template creates a whole solution, ready to use and optimizes effort on creating business value.
Features included in the template are:
- IoT Hub device management:
- create and register a device (with default tags)
- disable a device
- enable a device
- delete a device
- get a given device properties
- search devices according to given critera
- list devices
- Cloud to device communication:
- call Direct Methods through REST API requests
- update device twins (tags)
- update device twin (desired properties)
- create IoT Hub jobs (ex: device firmware update) and follow up status
- get IoT Hub’s jobs details
All that ready to use.
You only need to set the right IoT Hub connection string (ideally, secured or stored in a KeyVault) in appsettings.json file.
The template relies on works done in a previous VS2017 template, helping to accelerate REST API .NET Core 2.1.x solutions development.
This templates includes features like:
- Swagger/OpenAPI generation by config
- API and Swagger versionning
- .NET Core 2.1.x DI settings (configuration, dependency resolution, IOptions<>, exception management, etc)
One of the next steps in real world projects should be to secure the REST API, either by adding embedded security management code/settings in the VS solution or using Azure API Management.