华为云IOT平台设备获取api调用笔记

目的:验证华为云IOT平台的设备获取接口连通性

1、注册IAM账户

地址:https://console.huaweicloud.com/iam/?region=cn-north-4#/iam/users

华为云IOT平台设备获取api调用笔记

选择权限组,

华为云IOT平台设备获取api调用笔记2、创建好IAM后,需要重新登陆,并修改IAM账户密码

华为云IOT平台设备获取api调用笔记 

地址:https://auth.huaweicloud.com/authui/login.html?locale=zh-cn&service=https%3A%2F%2Fwww.huaweicloud.com%2Fproduct%2Fiothub.html#/login

3、token获取

参考文档:认证鉴权_设备接入 IoTDA_API参考_应用侧API参考_如何调用API_华为云 

在postman中调试接口,

post请求:https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens

Header参数:Content-Type:application/json

Body参数:


    “auth”: { 
        “identity”: { 
            “methods”: [ 
                “password” 
            ], 
            “password”: { 
                “user”: { 
                    “name”: “IAM用户名”, 
                    “password”: “IAM账户的密码”, 
                    “domain”: { 
                        “name”: “IAM账户名” 
                    } 
                } 
            } 
        }, 
        “scope”: { 
            “project”: { 
                “name”: “项目名” 
            } 
        } 
    } 
}

响应结果,可以看出token在响应头里面:

华为云IOT平台设备获取api调用笔记

 4、使用token调用设备获取接口

参考文档地址:https://apiexplorer.developer.huaweicloud.com/apiexplorer/debug?product=IoTDA&api=ListDevices

GET请求地址:https://iotda.cn-north-4.myhuaweicloud.com/v5/iot/5f5d6375d5da4499b241ac5f948a80bf/devices

Headers头部设置参数X-Auth-Token,为token的值

Body参数:无

响应结果:

{
    "devices": [
        {
            "app_id": "080be467039547fcb519a8c6e7edb606",
            "app_name": "DefaultApp_62ec18et",
            "device_id": "62ec8d225f266f255bb99479_ZWG400-COM-002",
            "node_id": "ZWG400-COM-002",
            "gateway_id": "62ec8d225f266f255bb99479_ZWG400-COM-002",
            "device_name": "002模块",
            "node_type": "GATEWAY",
            "description": null,
            "fw_version": null,
            "sw_version": null,
            "device_sdk_version": null,
            "product_id": "62ec8d225f266f255bb99479",
            "product_name": "测试数传模块",
            "status": "INACTIVE",
            "tags": []
        },
        {
            "app_id": "080be467039547fcb519a8c6e7edb606",
            "app_name": "DefaultApp_62ec18et",
            "device_id": "62ec8d225f266f255bb99479_Mobile-001",
            "node_id": "Mobile-001",
            "gateway_id": "62ec8d225f266f255bb99479_Mobile-001",
            "device_name": "手机应用端",
            "node_type": "GATEWAY",
            "description": null,
            "fw_version": null,
            "sw_version": null,
            "device_sdk_version": null,
            "product_id": "62ec8d225f266f255bb99479",
            "product_name": "测试数传模块",
            "status": "OFFLINE",
            "tags": []
        },
        {
            "app_id": "080be467039547fcb519a8c6e7edb606",
            "app_name": "DefaultApp_62ec18et",
            "device_id": "62ec8d225f266f255bb99479_ZWG400-COM-001",
            "node_id": "ZWG400-COM-001",
            "gateway_id": "62ec8d225f266f255bb99479_ZWG400-COM-001",
            "device_name": "001模块",
            "node_type": "GATEWAY",
            "description": null,
            "fw_version": null,
            "sw_version": null,
            "device_sdk_version": null,
            "product_id": "62ec8d225f266f255bb99479",
            "product_name": "测试数传模块",
            "status": "OFFLINE",
            "tags": []
        }
    ],
    "page": {
        "count": 3,
        "marker": "62ecba6e2766a210982ceed2"
    }
}

本文章来源于互联网,如有侵权,请联系删除!原文地址:华为云IOT平台设备获取api调用笔记

相关推荐: 智慧农业物联网应用平台解决方案

2021年最新智慧农业物联网应用平台解决方案(专业完整版).pdf-C++文档类资源-CSDN下载 本文章来源于互联网,如有侵权,请联系删除!原文地址:智慧农业物联网应用平台解决方案相关推荐: OneNET物联网平台05 Linux平台下实现MQTTS协议产品…