Help Center/ EventGrid/ API Reference/ APIs/ Event Source Management/ Updating a Custom Event Source
Updated on 2025-05-06 GMT+08:00

Updating a Custom Event Source

Function

This API is used to update a custom event source.

URI

PUT /v1/{project_id}/sources/{source_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant resource space ID.

source_id

Yes

String

ID of the event source.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

description

No

String

Description of the event source.

detail

No

RocketMqDetail object

Message instance connection information encapsulated in JSON format.

Table 4 RocketMqDetail

Parameter

Mandatory

Type

Description

instance_id

No

String

RocketMQ instance ID.

group

Yes

String

Consumer group.

topic

Yes

String

Topic

access_key

Yes

String

Username.

secret_key

Yes

String

Secret key.

vpc_id

No

String

VPC ID.

subnet_id

No

String

Subnet ID.

namesrv_address

No

String

Connection address.

ssl_enable

No

Boolean

SSL

enable_acl

No

Boolean

Indicates whether to enable ACL.

Response Parameters

Status code: 200

Table 5 Response header parameters

Parameter

Type

Description

X-Request-Id

String

This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname.

Table 6 Response body parameters

Parameter

Type

Description

id

String

ID of the event source.

name

String

Name of the event source.

label

String

Label of the event source.

description

String

Description of the event source.

provider_type

String

Type of the event source provider, which can be OFFICIAL (official cloud service event source), CUSTOM (custom event source), or PARTNER (partner event source).

event_types

Array of event_types objects

List of event types provided by the event source. Only the official cloud service event source provides event types.

created_time

String

UTC time when the event source is created.

updated_time

String

UTC time when the event source is updated.

channel_id

String

ID of the event channel to which the event source belongs.

channel_name

String

Name of the event channel to which the event source belongs.

type

String

Type of the event source.

detail

Object

Connection information encapsulated in JSON format in the message instance, such as the instance_id field of the RabbitMQ instance, vhost field of the virtual host, queue field, username, and password.

status

String

Status of the custom event source.

error_info

ErrorInfo object

Error message.

Table 7 event_types

Parameter

Type

Description

name

String

Name of the event type.

description

String

Description of the event type.

Table 8 ErrorInfo

Parameter

Type

Description

error_code

String

Error code.

error_detail

String

Error details.

error_msg

String

Error message.

Example Requests

Update a custom event source.

PUT https://{endpoint}/v1/{project_id}/sources/{source_id}

{
  "description" : "first event source"
}

Example Responses

Status code: 200

Operation successful.

{
  "id" : "90e0b962-c6c1-438c-ba8a-3024fe592bda",
  "name" : "first-source",
  "label" : "first-source",
  "description" : "first event source",
  "provider_type" : "CUSTOM",
  "event_types" : [ {
    "name" : "OBS:CloudTrace:ApiCall",
    "description" : "Service API call type event."
  } ],
  "created_time" : "2021-12-09 09:00:00",
  "updated_time" : "2021-12-09 09:00:00",
  "channel_id" : "bd14144e-8f3c-43d6-bdfd-bf09b52c2b96",
  "channel_name" : "channel",
  "type" : "RABBITMQ",
  "detail" : "{\"instance_id\":\"ac14144e-9v3c-43d6-acfd-bf09b52c98uy\",\"user_name\":\"rabbitmq_user\",\"password\":\"changeme\",\"vhost_name\":\"vhost_name\",\"queue_name\":\"queue_name\"}",
  "status" : "RUNNING",
  "error_info" : { }
}

Status Codes

Status Code

Description

200

Operation successful.

Error Codes

See Error Codes.