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

Updating a Custom Event Schema

Function

This API is used to update a custom event schema.

URI

PUT /v1/{project_id}/schemas/{schema_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant resource space ID.

schema_id

Yes

String

ID of the event schema.

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 schema.

compatibility

No

String

Compatibility of the event schema.

Response Parameters

Status code: 200

Table 4 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 5 Response body parameters

Parameter

Type

Description

id

String

ID of the event schema.

name

String

Name of the event schema. The value must be unique under a tenant.

description

String

Description of the event schema.

compatibility

String

Compatibility of the event schema.

provider_type

String

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

format

String

Format of the event schema.

number_of_versions

Integer

Number of event schema versions.

created_time

String

Time when the event schema is created.

updated_time

String

Time when the event schema is updated.

version

Integer

Current version number of the event schema.

definition

String

Event schema content definition.

Example Requests

Update a custom event schema.

PUT https://{endpoint}/v1/{project_id}/schemas/{schema_id}

{
  "description" : "Schema definition for a file upload event.",
  "compatibility" : "NONE"
}

Example Responses

Status code: 200

Information

{
  "id" : "2a0ee4f2-78a4-4122-80af-7455e37f64ee",
  "name" : "file.upload",
  "description" : "Schema definition for a file upload event.",
  "compatibility" : "NONE",
  "provider_type" : "CUSTOM",
  "format" : "OPENAPI_3_0",
  "number_of_versions" : 1,
  "created_time" : "2021-12-09 09:00:00",
  "updated_time" : "2021-12-09 09:00:00",
  "version" : 1,
  "definition" : "{\"$schema\": \"http://json-schema.org/draft-06/schema#\",\"title\": \"fileUpload\",\"definitions\": {\"fileUpload\": {\"properties\": {\"fileName\": {\"type\": \"string\"},\"fileSize\": {\"type\": \"integer\"}},\"required\": [\"foo\",\"bar\"],\"type\": \"object\"}},\"properties\": {\"specversion\": {\"type\": \"string\"},\"id\": {\"type\": \"string\"},\"type\": {\"type\": \"string\"},\"source\": {\"type\": \"string\"},\"subject\": {\"type\": \"string\"},\"datacontenttype\": {\"type\": \"string\"},\"dataschema\": {\"type\": \"string\"},\"time\": {\"format\": \"date-time\",\"type\": \"string\"},\"data\": {\"$ref\": \"#/definitions/fileUpload\"}},\"required\": [\"id\",\"source\",\"time\",\"type\",\"specversion\"],\"type\": \"object\"}"
}

Status Codes

Status Code

Description

200

Information

Error Codes

See Error Codes.