- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Getting Started with EG
- Permissions Management
- Event Sources
- Event Channels
- Event Subscriptions
- Event Streams
- Events
- Event Rules
- Event Targets
- Network Management
- IAM Projects and Enterprise Projects
- Authorization
- Event Monitoring
- Auditing
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Getting Started
-
APIs
-
Event Subscription Management
- Creating an Event Subscription
- Obtaining the Event Subscription List
- Updating an Event Subscription
- Obtaining Event Subscription Details
- Deleting an Event Subscription
- Updating an Event Subscription Source
- Creating an Event Subscription Target
- Updating an Event Subscription Target
- Obtaining Event Subscription Target Details
- Deleting an Event Subscription Target
- Enabling or Disabling Event Subscriptions
- Event Channel Management
- Event Management
- Event Source Management
- Event Target Catalog Management
-
Event Schema Management
- Starting Automatic Event Schema Discovery
- Creating a Custom Event Schema
- Obtaining the Event Schema List
- Updating a Custom Event Schema
- Obtaining Event Schema Details
- Deleting an Event Schema
- Creating a Custom Event Schema Version
- Obtaining the Event Schema Version List
- Obtaining Event Schema Version Details
- Deleting an Event Schema Version
- Connection Management
- Service Agency Management
- Quota Management
- API Version Management
- Trigger Management
- Endpoint Management
- OBS Bucket Management
- Metric Management
- Event Stream Management
- Event Example Management
-
Professional Event Stream Job Management
- Create a Professional Event Stream Job
- Querying Professional Event Stream Jobs
- Deleting a Professional Event Stream Job
- Querying Details About a Professional Event Stream Job
- Updating a Professional Event Stream Job
- Performing Operations on a Professional Event Stream Job
- Verifying Professional Event Stream Jobs
- Querying the Synchronization Status of a Professional Event Job
- Professional Event Stream Cluster Management
-
Event Subscription Management
- Permissions Policies and Supported Actions
- Appendix
- Description
- SDK Reference
-
FAQs
- How Is EG Billed?
- Why Did My Event Source Creation Fail?
- How Do I Configure a Security Group When Creating an Event Source?
- Why Did My Event Publishing Fail?
- Why Was the Target Not Triggered?
- Can I Push Custom Events to EG?
- How Do I Filter Events to Transmit to the Target?
- How Do I Transfer Custom Event Content to the Target?
- How Do I Obtain the SASL Certificate Address of a DMS for Kafka Instance?
- General Reference
Copied.
Creating a Custom Event Schema
Function
This API is used to create a custom event schema.
URI
POST /v1/{project_id}/schemas
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant resource space ID. |
Request 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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of the event schema. The value must be unique under a tenant. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. It must start with a letter or digit. |
description |
No |
String |
Description of the event schema. |
compatibility |
Yes |
String |
Compatibility of the event schema. |
format |
No |
String |
Schema content format. |
definition |
Yes |
String |
Event schema content definition. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. |
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
Create a schema.
POST https://{endpoint}/v1/{project_id}/schemas
{
"name" : "file.upload",
"description" : "Schema definition for a file upload event.",
"compatibility" : "NONE",
"format" : "OPENAPI_3_0",
"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\"}"
}
Example Responses
Status code: 200
Demo 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 |
Demo Information |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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