事件网格 EG
事件网格 EG
- 最新动态
- 功能总览
- 产品介绍
- 计费说明
- 快速入门
- 用户指南
- 最佳实践
- API参考
- SDK参考
- 常见问题
- 通用参考
链接复制成功!
创建自定义事件模型版本
功能介绍
创建自定义事件模型版本,版本号后台自动生成
URI
POST /v1/{project_id}/schemas/{schema_id}/versions
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
租户资源空间ID |
schema_id |
是 |
String |
指定查询的事件模型ID |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
definition |
否 |
String |
事件模型内容定义 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
X-Request-Id |
String |
This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
事件模型版本ID |
schema_id |
String |
事件模型ID |
version |
Integer |
事件模型版本号 |
format |
String |
事件模型格式 |
created_time |
String |
创建时间 |
updated_time |
String |
更新时间 |
definition |
String |
事件模型内容定义 |
请求示例
创建自定义事件模型版本
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\"}"
}
响应示例
状态码: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\"}"
}
状态码
状态码 |
描述 |
---|---|
200 |
Demo Information |
错误码
请参见错误码。
父主题: 事件模型管理