Creating a Custom Event Schema Version
Function
This API is used to create a custom event schema version. The version number is automatically generated in the background.
URI
POST /v1/{project_id}/schemas/{schema_id}/versions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant resource space ID. |
schema_id |
Yes |
String |
ID of the event schema. |
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 |
---|---|---|---|
definition |
No |
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 version. |
schema_id |
String |
ID of the event schema. |
version |
Integer |
Version number of the event schema. |
format |
String |
Format of the event schema. |
created_time |
String |
Time when the event schema is created. |
updated_time |
String |
Time when the event schema is updated. |
definition |
String |
Event schema content definition. |
Example Requests
Create a schema version.
POST https://{endpoint}/v1/{project_id}/schemas/{schema_id}/versions { "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" : "6f70e150-f20c-4c22-85aa-78ceecd52b98", "schema_id" : "2a0ee4f2-78a4-4122-80af-7455e37f64ee", "version" : 1, "format" : "OPENAPI_3_0", "created_time" : "2021-12-09 09:00:00", "updated_time" : "2021-12-09 09:00:00", "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