Authentication
Administrator. Session/administrative writes are not executed in the public Playground.
Endpoint
curl --request POST 'https://api.oneaster.ai/core/v1/admin/channels/1/revisions' \ --header 'Authorization: Bearer '"$ONEASTER_SESSION_TOKEN" \ --header 'Idempotency-Key: '"$ONEASTER_INTENT" \ --header 'Content-Type: application/json' \ --data "$REQUEST_BODY_JSON"
Parameters
- id (path, Required): {"type":"string","pattern":"^[0-9]+$"}
- Idempotency-Key (header, Required): {"type":"string","minLength":1,"maxLength":100}
Request JSON Schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"config": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"base_url": {
"type": "string"
},
"models": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"model": {
"type": "string"
},
"upstream_model": {
"type": "string"
}
},
"required": [
"model",
"upstream_model"
]
}
},
"groups": {
"type": "array",
"items": {
"type": "string"
}
},
"priority": {
"type": "integer",
"minimum": 0
},
"weight": {
"type": "integer",
"minimum": 0
},
"tag": {
"type": "string"
},
"notes": {
"type": "string"
},
"auto_disable": {
"type": "boolean"
},
"options": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"parameters": {
"type": "object",
"additionalProperties": {
"type": "number"
}
}
},
"required": [
"name",
"type",
"base_url",
"models",
"groups",
"priority",
"weight",
"tag",
"notes",
"auto_disable",
"options",
"headers",
"parameters"
]
},
"enabled": {
"type": "boolean"
},
"expected_version": {
"type": "integer",
"minimum": 0
},
"reference": {
"type": "string"
}
},
"required": [
"config",
"enabled",
"expected_version",
"reference"
]
}
Responses
200
同一幂等操作的原结果;不重新激活旧配置
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+$"
},
"version": {
"type": "integer",
"minimum": 0
},
"reused": {
"type": "boolean"
}
},
"required": [
"id",
"version",
"reused"
]
}
},
"required": [
"success",
"data"
]
}
}
}
201
修订独立渠道配置、模型映射和路由
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": true
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9]+$"
},
"version": {
"type": "integer",
"minimum": 0
},
"reused": {
"type": "boolean"
}
},
"required": [
"id",
"version",
"reused"
]
}
},
"required": [
"success",
"data"
]
}
}
}
default
错误代码见 core-api.md;供应商/数据库错误已隐藏。
{
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"success": {
"const": false
},
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"type": {
"const": "oneaster_error"
}
},
"required": [
"code",
"message",
"type"
]
},
"data": {
"type": "null"
}
},
"required": [
"success",
"error",
"data"
]
}
}
}