Generate an Access Credential
Function
This API is used by a client to generate an access credential, so the client can use the credential to connect to the platform through a protocol such as AMQP. Only one record is retained. If the API is called again, the access credential is reset and the previous one becomes invalid.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
iotda:accesscode:create
Write
-
g:EnterpriseProjectId
-
-
URI
POST /v5/iot/{project_id}/auth/accesscode
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Parameter description : project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Instance-Id | No | String | Parameter description : instance ID. Unique identifier of each instance in the physical multi-tenant scenario. Mandatory for professional editions and recommended in other cases. Log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. For details, see Viewing Instance Details. |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| access_key | String | Access credential name, which consists of 8 random characters. |
| access_code | String | Access credential. |
Example Requests
Generates an AMQP access credential.
POST https://{endpoint}/v5/iot/{project_id}/auth/accesscode
{
"type" : "AMQP"
} Example Responses
Status code: 201
{
"access_key" : "examples",
"access_code" : "examples"
} Status Codes
| Status Code | Description |
|---|---|
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | FORBIDDEN |
| 500 | Internal Server Error |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot