一機一密認證方法,即預先為每個設備申請唯一的訪問憑證(ClientId、DeviceAccessKeyId和DeviceAccessKeySecret)。當設備與云消息隊列 MQTT 版建立連接時,需要將設備訪問憑證中的信息按照約定的形式設置到Username和Password中,向云消息隊列 MQTT 版發(fā)起認證請求,云消息隊列 MQTT 版認證通過后激活設備,設備與云消息隊列 MQTT 版間才可傳輸數(shù)據(jù)。 本接口用于為指定設備申請訪問憑證。
接口說明
調(diào)試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
授權信息
當前API暫無授權信息透出。
請求參數(shù)
名稱 | 類型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
ClientId | string | 是 | 需要注冊訪問憑證的設備的 Client ID。 | GID_test@@@test |
InstanceId | string | 是 | 云消息隊列 MQTT 版實例的 ID,一定要和客戶端實際使用的實例 ID 匹配。您可以在控制臺實例詳情頁面獲取該 ID。 | post-cn-0pp12gl**** |
返回參數(shù)
示例
正常返回示例
JSON
格式
{
"RequestId": "E4581CCF-62AF-44D9-B5B4-D1DBDC0E****",
"DeviceCredential": {
"UpdateTime": 1605541382000,
"DeviceAccessKeyId": "DC.Z5fXh9sRRVufyLi6wo****",
"CreateTime": 1605541382000,
"InstanceId": "post-cn-0pp12gl****",
"DeviceAccessKeySecret": "DC.BJMkn4eMQJK2vaApTS****",
"ClientId": "GID_test@@@test"
}
}
錯誤碼
HTTP status code | 錯誤碼 | 錯誤信息 | 描述 |
---|---|---|---|
400 | ApplyTokenOverFlow | You have applied for tokens too many times. Please try again later. | 申請Token頻率過高,系統(tǒng)限流,請重試。 |
400 | CheckAccountInfoFailed | An error occurred while checking the account information by the STS token. | 解析STS Token賬號信息失敗。 |
400 | InstancePermissionCheckFailed | An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings. | 實例權限校驗失敗,請確認MQTT實例的所屬關系以及授權策略。 |
400 | ParameterCheckFailed | An error occurred while validating the parameters. The parameters may be missing or invalid. | 參數(shù)校驗失敗,可能缺失或者傳入值非法。 |
400 | PermissionCheckFailed | An error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings. | 資源權限校驗失敗,請檢查實例、Topic和Group ID的所屬權限和授權策略。 |
400 | InvalidParameter.%s | An error occurred while validating the parameter. The parameter may be missing or invalid. | 參數(shù)校驗失敗,可能缺失或者傳入值非法。 |
400 | DeviceCredentialNumExceed | The number of device credentia exceeds the limit. Please revoke unused device certificates | - |
400 | DeviceCredentialExsit | Device Credential Exsit | - |
400 | DeviceCredentialNotFound | Device Credential Not Found. Check if the device certificate is registered | - |
404 | ApiNotSupport | The specified API is not supported. | 當前接口不支持,請檢查。 |
500 | InternalError | An error occurred while processing your request. Try again later. | MQTT后端服務異常,請重試。 |
500 | SystemOverFlow | An error occurred while processing your request. Please try again. | 系統(tǒng)限流,請重試。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
變更時間 | 變更內(nèi)容概要 | 操作 |
---|---|---|
2023-04-06 | OpenAPI 錯誤碼發(fā)生變更 | 查看變更詳情 |