Updated on 2025-11-25 GMT+08:00

Updating an Event Subscription

Function

This API is used to update an event subscription.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/event-subs/{subscription_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For how to obtain it, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 1 to 64 characters. Only letters and digits are allowed.

Default Value

N/A

subscription_id

Yes

String

Definition

Subscription ID.

Constraints

N/A

Range

The value can contain 1 to 64 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. For details, see Token-based Authentication.

Constraints

N/A

Range

The value can contain 1 to 32,768 characters.

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

enable

No

Boolean

Definition

Whether to enable subscription

Constraints

N/A

Range

  • true: Subscription is enabled.

  • false: Subscription is disabled.

Default Value

false

event_ids

No

Array

Definition

IDs of events contained in the subscription. Event IDs are separated by commas (,). Each event type corresponds to a fixed event ID.

Constraints

N/A

Range

  • dis_event.000: dump task restoration

  • dis_event.001: dump task exception

  • dis_event.002: insufficient quota

  • dis_event.003: restricted traffic

  • dis_event.004: automatic stream scaling succeeded

  • dis_event.005: automatic stream scaling failed

  • dis_event.006: abnormal stream traffic

  • dis_event.007: stream traffic restored

  • dis_event.008: manual stream scale-up/down failed

Default Value

N/A

event_streamids

No

Array

Definition

IDs of the streams to subscribe to. If stream subscription is disabled, all streams are subscribed to by default. If stream subscription is enabled, you can select the IDs of the streams to subscribe to. The IDs are separated by commas (,).

Constraints

N/A

Range

N/A

Default Value

N/A

name

No

String

Definition

Name of the subscription to be updated

Constraints

N/A

Range

The value can contain 1 to 64 characters. Only letters and digits are allowed.

Default Value

N/A

topic_name

Yes

String

Definition

SMN topic name or DIS stream name, which cannot be left blank. If the subscription type is SMN, this parameter indicates the name of the selected SMN topic. If the subscription type is DIS, this parameter indicates the name of the selected DIS stream.

Constraints

There must be an SMN topic or DIS stream. Otherwise, you must create one.

Range

N/A

Default Value

N/A

topic_type

No

Integer

Definition

Subscription type, which can be SMN notification or DIS stream

Constraints

N/A

Range

  • 0: SMN notification

  • 1: DIS stream

Default Value

N/A

topic_urn

No

String

Definition

Uniform resource name of the topic

Constraints

If the subscription type is DIS, the value is null. If the subscription type is SMN, the value is a string in the following format: urn:smn:region_id:projectid:smn topic.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Normal response

None

Example Requests

  • Update the event subscription type to SMN notification.

    PUT https://{Endpoint}/v1/{project_id}/event-subs/{subscription_id}
    
    {
      "enable" : true,
      "events_ids" : "0: \"dis_event.000\"\n1: \"dis_event.001\"",
      "event_streamids" : [ ],
      "name" : "dis-test1",
      "topic_name" : "test",
      "topic_type" : 0,
      "topic_urn" : "urn:smn:cn-southwest-2:575ae927fc644f22b5c5af5209b7cf51:test"
    }
  • Update the event subscription type to DIS stream.

    {
      "enable" : true,
      "events_ids" : "0: \"dis_event.000\"\n1: \"dis_event.001\"",
      "event_streamids" : "0: \"Xs5eBSKtWBbFJR2xxxx\"\n1: \"e4CH131AqCyjucWxxxx\"",
      "name" : "dis-test1",
      "topic_name" : "dis-boce-notelete",
      "topic_type" : 1,
      "topic_urn" : null
    }

Example Responses

None

Status Codes

Status Code

Description

200

Normal response

Error Codes

See Error Codes.