物接入IoT Hub

    Permission

    获取policy下所有topic信息

    相对URI HTTP 方式
    /v1/endpoint/{endpointName}/permission?policyName={policyName} GET

    请求参数

    名称 类型 是否必选 默认值 说明
    endpointName String Y - endpoint名称
    policyName String Y - policy名称
    order ENUM['desc', 'asc'] N desc 排序的方式,不区分大小写
    orderBy String N createTime 仅支持基于createTime排序
    pageNo Int N 1 页码
    pageSize Int N 50 每页item个数,最大值200

    返回参数

    名称 类型 含义
    operations List[ENUM] 允许的操作 list
    permissionUuid String permission的ID
    policyUuid String policy的ID
    topic String 操作对应的Topic
    createTime String 创建时间

    请求示例

    GET /v1/endpoint/endpoint-1/permission?policyName=policy-1 HTTP/1.1
    host: iot.gz.baidubce.com
    authorization: {authorization}
    content-type: text/plain;charset=UTF-8

    返回示例

    HTTP/1.1 200 OK
    x-bce-request-id: eaa235de-f71c-4ed4-baa0-8b380ffb90ba
    Content-Type: application/json;charset=UTF-8
    {
        "totalCount": 1,
        "result": [
             {
                 "policyUuid": "f1615eb2-9ff7-439f-b9db-8c2c5a5476b9",
                 "operations": [
                                "PUBLISH",
                                "SUBSCRIBE"
                          ],
                 "topic": "topic1",
                 "createTime": "2016-08-31T06:44:01Z",
                 "permissionUuid": "ba8313a8-b2ed-4079-8160-00fc168d6d9c"
             }
         ],
        "order": "desc",
        "orderBy": "createtime",
        "pageSize": 50,
        "pageNo": 1
    }

    获取指定topic的信息

    相对URI HTTP 方式
    /v1/endpoint/{endpointName}/permission/{permissionUuid} GET

    请求参数

    名称 类型 是否必选 含义
    endpointName String Y endpoint名称
    permissionUuid String Y permission的ID

    返回参数

    名称 类型 含义
    operations List[ENUM] 允许的操作 list
    permissionUuid String permission的ID
    policyUuid String policy的ID
    topic String 操作对应的Topic
    createTime String 创建时间

    请求示例

    GET /v1/endpoint/endpoint-1/permission/ba8313a8-b2ed-4079-8160-00fc168d6d9c HTTP/1.1
    host: iot.gz.baidubce.com
    authorization: {authorization}
    content-type: text/plain;charset=UTF-8

    返回示例

    HTTP/1.1 200 OK
    x-bce-request-id: 139eedb4-14f9-4512-94fb-bbac2b334bf3
    Content-Type: application/json;charset=UTF-8
    {
        "policyUuid": "f1615eb2-9ff7-439f-b9db-8c2c5a5476b9",
        "operations": [
                "PUBLISH",
                "SUBSCRIBE"
             ],
        "topic": "topic1",
        "createTime": "2016-08-31T06:44:01Z",
        "permissionUuid": "ba8313a8-b2ed-4079-8160-00fc168d6d9c"
    }

    在policy下设置topic

    相对URI HTTP 方式
    /v1/endpoint/{endpointName}/permission POST

    请求参数

    名称 类型 是否必选 含义
    endpointName String Y endpoint名称
    policyName String Y 所属的Policy名称
    operations List[ENUM] Y 允许的操作list
    topic String Y 操作对应的Topic

    返回参数

    名称 类型 含义
    operations List[ENUM] 允许的操作 list
    permissionUuid String permission的ID
    policyUuid String policy的ID
    topic String 操作对应的Topic
    createTime String 创建时间

    请求示例

    POST /v1/endpoint/endpoint-1/permission HTTP/1.1
    host: iot.gz.baidubce.com
    authorization: {authorization}
    content-type: text/plain;charset=UTF-8
    {
        "policyName":"policy-1"
        "operations":["PUBLISH","SUBSCRIBE"]
        "topic":"topic1"
    }

    返回示例

    HTTP/1.1 201 Created
    x-bce-request-id: 6fb3044f-b5ef-4a8f-a416-51fa0e48f510
    Content-Type: application/json;charset=UTF-8
    {
        "policyUuid": "f1615eb2-9ff7-439f-b9db-8c2c5a5476b9",
        "operations": [
                "PUBLISH",
                "SUBSCRIBE"
            ],
        "topic": "topic1",
        "createTime": "2016-08-31T06:44:01Z",
        "permissionUuid": "ba8313a8-b2ed-4079-8160-00fc168d6d9c"
    }

    更新已有的topic设置

    相对URI HTTP 方式
    /v1/endpoint/{endpointName}/permission/{permissionUuid} PUT

    请求参数

    名称 类型 是否必选 含义
    endpointName String Y endpoint名称
    permissionUuid String Y permission的ID
    operations List[ENUM] Y 允许的操作list
    topic String Y 操作对应的Topic

    返回参数

    名称 类型 含义
    operations List[ENUM] 允许的操作 list
    permissionUuid String permission的ID
    policyUuid String policy的ID
    topic String 操作对应的Topic
    createTime String 创建时间

    请求示例

    PUT /v1/endpoint/endpoint-1/permission/ba8313a8-b2ed-4079-8160-00fc168d6d9c HTTP/1.1
    host: iot.gz.baidubce.com
    authorization: {authorization}
    content-type: text/plain;charset=UTF-8
    {
        "operations":["PUBLISH"]
        "topic":"topic2"
    }

    返回示例

    HTTP/1.1 201 Created
    x-bce-request-id: 853459a6-b933-4546-8bac-8a174516e83f
    Content-Type: application/json;charset=UTF-8
    {
        "policyUuid": "f1615eb2-9ff7-439f-b9db-8c2c5a5476b9",
        "operations": [
                "PUBLISH"            
            ],
        "topic": "topic2",
        "createTime": "2016-08-31T06:44:01Z",
        "permissionUuid": "ba8313a8-b2ed-4079-8160-00fc168d6d9c"
    }

    删除已有的topic

    相对URI HTTP 方式
    /v1/endpoint/{endpointName}/permission/{permissionUuid} DELETE

    请求参数

    名称 类型 是否必选 含义
    endpointName String Y endpoint名称
    permissionUuid String Y permission的ID

    返回参数

    无特殊返回参数。

    请求示例

    DELETE /v1/endpoint/endpoint-1/permission/ba8313a8-b2ed-4079-8160-00fc168d6d9c HTTP/1.1
    host: iot.gz.baidubce.com
    authorization: {authorization}
    content-type: text/plain;charset=UTF-8

    返回示例

    HTTP/1.1 204 No Content
    x-bce-request-id: 44dcf34e-bc58-46a8-8492-cde566c69328
    Content-Type: application/json;charset=UTF-8
    上一篇
    Policy
    下一篇
    Client