Create a Generic-Protocol Configuration
Function
This API is used to create generic-protocol configurations.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
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.
URI
POST /v5/iot/{project_id}/protocol-configs
| 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. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| port | Yes | Integer | Parameter description: port number configured for the generic protocol. |
| keepalive_timeout | No | Integer | Parameter description: connection idle timeout, in seconds. |
| protocol_type | Yes | String | Parameter description: protocol type. Value: TCP (general TCP access). |
| description | No | String | Parameter description: description of the generic protocol. Value: The value can contain a maximum of 2,048 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed. |
| ssl_enable | No | Boolean | Parameter description: whether to enable TLS encrypted transmission. |
| frame_decode_configs | No | Array of FrameDecodeConfig objects | Parameter description: stream segmentation/reassembly configuration list. |
| codec_mode | Yes | String | Parameter description: Codec type. Value: |
| func_urn | No | String | Parameter description: Uniform Resource Name (URN) of a function, which uniquely identifies the function. It is the address of the function that uses FGS for encoding and decoding. Value: The value can contain a maximum of 256 characters. Only letters, digits, underscores (_), hyphens (-), and colons (:) are allowed. |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| protocol_id | String | Parameter description: ID of the generic-protocol configuration. |
| port | Integer | Parameter description: port number configured for the generic protocol. |
| keepalive_timeout | Integer | Parameter description: connection idle timeout, in seconds. |
| protocol_type | String | Parameter description: protocol type. Value: TCP (general TCP access). |
| description | String | Parameter description: description of the generic protocol. Value: The value can contain a maximum of 2,048 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed. |
| ssl_enable | Boolean | Parameter description: whether to enable TLS encrypted transmission. |
| frame_decode_configs | Array of FrameDecodeConfig objects | Parameter description: stream segmentation/reassembly configuration list. |
| codec_mode | String | Parameter description: Codec type. Value: |
| func_urn | String | Parameter description: Uniform Resource Name (URN) of a function, which uniquely identifies the function. It is the address of the function that uses FGS for encoding and decoding. Value: The value can contain a maximum of 256 characters. Only letters, digits, underscores (_), hyphens (-), and colons (:) are allowed. |
| create_time | String | Parameter description: time when the custom authentication is queried in the IoT platform. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. |
| update_time | String | Parameter description: updated time when the custom authentication is queried in the IoT platform. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. |
Example Requests
Creates a generic-protocol configuration.
POST https://{endpoint}/v5/iot/{project_id}/protocol-configs
{
"port" : 6886,
"protocol_type" : "TCP",
"description" : "tcp protocol",
"frame_decode_configs" : [ {
"frame_decode_type" : "DELIMITER",
"max_frame_length" : 200,
"delimiter" : "]"
} ],
"codec_mode" : "FGS",
"keepalive_timeout" : 600,
"ssl_enable" : true,
"func_urn" : "urn:fss:cn-north-5:d92d9c5eb8e347b5bb31ecfe5bc0c4e1:function:default:mqtt_auth:latest"
} Example Responses
Status code: 201
Created
{
"protocol_id" : "9739d740-4da1-46e1-8075-77145265cd92",
"port" : 6886,
"protocol_type" : "TCP",
"description" : "tcp protocol",
"frame_decode_configs" : [ {
"frame_decode_type" : "DELIMITER",
"max_frame_length" : 200,
"delimiter" : "]"
} ],
"codec_mode" : "FGS",
"keepalive_timeout" : 600,
"ssl_enable" : true,
"func_urn" : "urn:fss:cn-north-5:d92d9c5eb8e347b5bb31ecfe5bc0c4e1:function:default:mqtt_auth:latest",
"create_time" : "20231031T070547Z",
"update_time" : "20231031T070547Z"
} Status Codes
| Status Code | Description |
|---|---|
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 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