Publishing a Detection Message
Function
Specifies the HTTP or HTTPS detection messages sent based on topics. These messages are used to check whether the current HTTP or HTTPS endpoint is available and whether the SMN egress can access the endpoint.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/notifications/topics/{topic_urn}/detection
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Specifies the project ID. For details about how to obtain the project ID, see Obtaining the Project ID. |
topic_urn | Yes | String | Specifies the resource identifier of the topic, which is unique. To obtain the resource identifier, see Querying Topics. |
Request Parameters
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | Specifies a user token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
protocol | Yes | String | Specifies the protocol type. Only http and https are supported. This field cannot be left blank. |
endpoint | Yes | String | Specifies the endpoint address to be detected. The address must start with http:// or https:// and cannot be left blank. |
extension | No | extension object | Specifies the extended information for subscriptions over HTTP or HTTPS. You can specify multiple key/value pairs for the HTTP or HTTPS protocol. These key/value pairs will be carried as the request header when HTTP or HTTPS messages are sent. extension can be left blank. header can be left blank. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | No | Map<String,String> | Specifies the header for subscriptions over HTTP or HTTPS. The header must meet the following requirements:
|
Response Parameters
Status code: 200
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID. |
task_id | String | Specifies the detection task ID. |
Status code: 400
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID, which is unique. |
code | String | Specifies the error code. |
message | String | Describes the error message. |
Status code: 403
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID, which is unique. |
code | String | Specifies the error code. |
message | String | Describes the error message. |
Status code: 404
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID, which is unique. |
code | String | Specifies the error code. |
message | String | Describes the error message. |
Status code: 429
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID, which is unique. |
code | String | Specifies the error code. |
message | String | Describes the error message. |
Status code: 500
Parameter | Type | Description |
---|---|---|
request_id | String | Specifies the request ID, which is unique. |
code | String | Specifies the error code. |
message | String | Describes the error message. |
Example Requests
Example
POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_create_topic_v2/detect{"protocol" : "http","endpoint" : "http://172.20.0.51:32000/http_notify","extension" : {"header" : {"x-abc" : "1213","x-abc-cba" : "test2"}}}
Example Responses
Status code: 200
Detection succeeded.
{"request_id" : "adc82efa7e0042899722531681b1959a","task_id" : "adc82efa7e0042899722531681b1959a"}
Status code: 400
Detection failed.
{"request_id" : "373cdb9696e44454832ea02e61a2c689","error_code" : "SMN.00011004","error_msg" : "Parameter: Extension is invalid. Http header key is invalid."}
Status Codes
Status Code | Description |
---|---|
200 | Detection succeeded. |
400 | Detection failed. |
403 | Unauthorized |
404 | Not Found |
429 | Too Many Requests |
500 | Internal Server Error |
Error Codes
See Error Codes.
- Calling Method
- URI