Git Product home page Git Product logo

postman-azure-iot-hub-device-operations's Introduction

Cypress

Git Hub action to run Postman Collection integration tests

Reference: https://github.com/OctopusSamples/junit-newman-test/blob/main/GitHubTree.json

Azure IoTHub Device Operations

This is a Postman collection which allows basic device operations executed via Postman using javascript.   Operations:

  • Register a device throught Azure Device Provisioning Service.
  • Retrive device twin properties throght Azure IoT Hub.

Registering a device using Device Provisioning service:

URL: https://global.azure-devices-provisioning.net/[ID_Scope]/registrations/[registration_id]/register?api-version=2021-06-01

HTTP Method:PUT

Request Headers:

  • Authorization: sasToken
  • Content-type: application/json

If using key-based authentication, a security token is passed in the HTTP Authorization request header in the following format:

SharedAccessSignature sig={signature}&se={expiry}&skn={policyName}&sr={URL-encoded-resourceURI}

Request Body:

{
  "registrationId": "cXdlX3F3ZV9xX3F3ZQ"
}

SasToken example:

 SharedAccessSignature sr=0ne002ee24e%2Fregistrations%2Fcxdlx3f3zv9xx3f3zq&sig=mM%2F%2BCl4qA8zrjhG3gBC%2Fbgw6xqftBf3eL6%2BgPQ%2FaPu8%3D&se=1660075663

  How sas tokens are generated:

Link to official documentation: https://docs.microsoft.com/en-us/azure/iot-dps/how-to-control-access

Retrieve device twin from Azure IoT Hub

URL: https://{{hubName}}.azure-devices.net/twins/{{deviceId}}?api-version=2016-11-14

HTTP Method: GET

Request Headers:

  • Authorization: sasToken

The security token has the following format for retrieving the device twin:

 SharedAccessSignature sig={signature}&se={expiry}&skn={policyName}&sr={URL-encoded-resourceURI}

SasToken example:

SharedAccessSignature sr=iothub-iomt-iothub-v1-dev-westeurope.azure-devices.net&sig=H92FehA0llWjbHYSYAxqMp4M3fOQH%2Fy%2F73%2FV3%2BWz0TA%3D&se=1660075777&skn=iothubowner

  How sas tokens for retrieving device twin are generated:

Link to official documentation: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-dev-guide-sas?tabs=java

postman-azure-iot-hub-device-operations's People

Contributors

alvelchev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.