批量创建路由规则
POST
/naming/v2/routings
最后修改时间:2024-08-21 04:21:07
责任人:未设置
请求参数
Header 参数
X-Polaris-Token
string
必需
Body 参数application/json
array of:
name
string
路由规则名称
enable
boolean
是否启用路由规则
routing_policy
string
规则类型
routing_config
object
规则列表
@type
string
必需
rules
array [object {3}]
必需
description
string
规则描述
priority
integer
路由规则优先级
id
string
规则ID
示例
[
{
"name": "demo-123",
"namespace": "",
"enable": true,
"routing_policy": "RulePolicy",
"routing_config": {
"@type": "type.googleapis.com/v1.RuleRoutingConfig",
"rules": [
{
"name": "规则一",
"sources": [
{
"service": "echo",
"namespace": "default",
"arguments": [
{
"type": "CUSTOM",
"key": "uid",
"value": {
"type": "EXACT",
"value": "123",
"value_type": "TEXT"
}
}
]
}
],
"destinations": []
}
]
}
}
]
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://119.91.66.223:8090/naming/v2/routings' \
--header 'X-Polaris-Token;' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"name": "demo-123",
"namespace": "",
"enable": true,
"routing_policy": "RulePolicy",
"routing_config": {
"@type": "type.googleapis.com/v1.RuleRoutingConfig",
"rules": [
{
"name": "规则一",
"sources": [
{
"service": "echo",
"namespace": "default",
"arguments": [
{
"type": "CUSTOM",
"key": "uid",
"value": {
"type": "EXACT",
"value": "123",
"value_type": "TEXT"
}
}
]
}
],
"destinations": []
}
]
}
}
]'
返回响应
🟢200成功
application/json
Body
code
integer
响应码
info
string
提示信息
示例
{
"code": 0,
"info": "string"
}
修改于 2024-08-21 04:21:07