Skip to main content
Version: Next

Local Model

Description#

  • Standalone environment, then use the local API to update the apache shenyu gateway data.the yaml config:
shenyu:  local:    enabled: true    sha512Key: 123456
  • Common result:
success
  • Common preFix: localhost:9095/shenyu

  • Common Header: localKey: 123456

Plugin#

saveOrUpdate#

save or update plugin data

Request Method#

POST

Path#

/plugin/saveOrUpdate

Request Parameters#
NameTypeRequiredDefaultDescription
PluginDataPluginDataTruePlugin data object (pass Json object inside Body)
PluginData
#
NameTypeRequiredDefaultDescription
idStringFalseplugin id
nameStringTrueplugin name
configStringFalseplugin configuration (Json format)
roleStringFalseplugin role
enabledBooleanFalsewhether to turn on
Example#

POST body

{"id":3,"name":"divide","enabled":"true"}

CleanAll#

Clear all data (plugins, selectors, rules)

Request Method#

GET

Path#

/cleanAll

Clean Plugin#

Clear plugin data(selector, rule)

Request Method#

GET

Path#

/cleanPlugin?name = xxxx

RequestParam#
NameTypeRequiredDefaultDescription
nameStringtrueplugin name

Delete plugin#

Remove plugin data (not included, the selectors and rules data)

Request Method#

GET

Path#

/plugin/delete?name = xxxx

RequestParam#
NameTypeRequiredDefaultDescription
nameStringtrueplugin name

Delete All Plugin#

Remove all plugin data (not included, the selectors and rules data)

Request Method#

GET

Path#

/plugin/deleteAll

Find plugin by name#

Find plugin by name

Request Method#

GET

Path#

/plugin/findByName?name=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
nameStringtrueplugin name

Save or Update Selector#

Save or Update Selector

Request Method#

POST

Path#

/plugin/selector/saveOrUpdate

RequestParam#
NameTypeRequiredDefaultDescription
SelectorDataSelectorDataTrueSelector object (pass Json object inside Body)
SelectorData
#
NameTypeRequiredDefaultDescription
idStringFalseselector id
pluginNameStringTrueplugin name
nameStringFalseSelector name (default is plugin:selector+random number if not filled)
matchModeIntegerFalseMatching mode (0:and;1:or), not filled with the default generation And mode
typeIntegerFalseTraffic type(0: full traffic; 1: custom traffic) do not fill in the default generation of full traffic
sortIntegerFalseSort by, not filled by default generate 10
enabledBooleanFalseWhether to turn on, not fill in the default generation true
loggedBooleanFalseWhether or not to print the log, do not fill in the default generated into false
handleStringFalseSelector handler (Json objects, depending on each plug-in, different objects are passed)
conditionListConditionFalseConditional collection, custom traffic needs to be passed, full traffic does not need to be passed (Json List object)
Condition
#
NameTypeRequiredDefaultDescription
paramTypeStringTrueparam type(post,uri,query,host,header,cookie,req_method,domain)
operatorStringTrueoperator (match,=,regex,>,<,contains,SpEL,Groovy,TimeBefore,TimeAfter)
paramNameStringFalseparam mame(The uri parameter type can be passed without)
paramValueIntegerFalseparam value
Example#

POST body

{    "pluginName": "divide",    "type": 1,    "handle": "[{\"upstreamUrl\":\"127.0.0.1:8089\"}]",    "conditionDataList": [{        "paramType": "uri",        "operator": "match",        "paramName": null,        "paramValue": "/**"    }]}
Result#

Is selector id

xxxxx

Add Selector And Rules#

Add a selector with multiple rules

Request Method#

POST

Path#

/plugin/selectorAndRules

RequestParam#
NameTypeRequiredDefaultDescription
SelectorRulesDataSelectorRulesDataTrueSelector rule object (Body inside pass Json object)
SelectorRulesData
#
NameTypeRequiredDefaultDescription
pluginNameStringTrueplugin name
selectorNameStringFalseSelector name (if not filled in, it is generated by default plugin:selector+random number)
matchModeIntegerFalseMatching mode (0:and;1:or), not filled with the default generation And mode
selectorHandlerStringFalseSelector handler (Json objects, depending on each plug-in, different objects are passed)
conditionListConditionDataTrueSelector condition collection (Json List object)
ruleDataListRuleLocalDataTrueRule condition collection (Json List object)
RuleLocalData
#
NameTypeRequiredDefaultDescription
ruleNameStringFalserule name
ruleHandlerStringTrueRule handler (different plugins pass different values))
matchModeIntegerFalseMatching pattern (0:and;1:or)
conditionListConditionDataTrueRule condition collection (Json List object)
ConditionData
#
NameTypeRequiredDefaultDescription
paramTypeStringTrueparam type(post,uri,query,host,header,cookie,req_method,domain)
operatorStringTrueoperator (match,=,regex,>,<,contains,SpEL,Groovy,TimeBefore,TimeAfter)
paramNameStringFalseparam mame(The uri parameter type can be passed without)
paramValueIntegerFalseparam value
Example#

POST body

{    "pluginName": "divide",    "selectorHandler": "[{\"upstreamUrl\":\"127.0.0.1:8089\"}]",    "conditionDataList": [{        "paramType": "uri",        "operator": "match",        "paramValue": "/http/**"    }],    "ruleDataList": [{        "ruleHandler": "{\"loadBalance\":\"random\"}",        "conditionDataList": [{            "paramType": "uri",            "operator": "=",            "paramValue": "/http/test/payment"        }]    }, {        "ruleHandler": "{\"loadBalance\":\"random\"}",        "conditionDataList": [{            "paramType": "uri",            "operator": "=",            "paramValue": "/http/order/save"        }]    }]}

Delete Selector#

Delete selectors based on selector id and plugin name

Request Method#

GET

Path#

/plugin/selector/delete?pluginName=xxxx&&id=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
pluginNameStringtrueplugin name
idStringtrueselector id

Find All Selector#

Get all selectors by plugin name

Request Method#

GET

Path#

/plugin/selector/findList?pluginName=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
pluginNameStringtrueplugin name

Save or Update Rule Data#

Save or Update Rule Data

Request Method#

POST

Path#

/plugin/rule/saveOrUpdate

RequestParam#
NameTypeRequiredDefaultDescription
RuleDataRuleDataTrueRule object (pass Json object inside Body)
RuleData
#
NameTypeRequiredDefaultDescription
idStringFalserule id
pluginNameStringTrueplugin name
nameStringFalseRule name (default generation if not filled plugin:rule+random number)
selectorIdStringTrueSelector id
matchModeIntegerFalseMatching mode (0:and;1:or), not filled with the default generation And mode
sortIntegerFalseSort by , not filled by default generate 10
enabledBooleanFalseWhether to turn on, not fill in the default generation true
loggedBooleanFalseWhether or not to print the log, do not fill in the default generated into false
handleStringFalseRule handler (Json objects, depending on each plug-in, different objects are passed)
conditionListConditionDataFalseConditional collections (Json List objects)
conditionList
#
NameTypeRequiredDefaultDescription
paramTypeStringTrueparam type(post,uri,query,host,header,cookie,req_method,domain)
operatorStringTrueoperator (match,=,regex,>,<,contains,SpEL,Groovy,TimeBefore,TimeAfter)
paramNameStringFalseparam mame(The uri parameter type can be passed without)
paramValueIntegerFalseparam value
Example#

POST body

{    "pluginName": "divide",    "selectorId": 123456,    "handle": "{\"loadBalance\":\"random\"}",    "conditionDataList": [{        "paramType": "uri",        "operator": "=",        "paramValue": "/test"    }]}
Result#

Is rule id

xxxxx

Delete rule data#

Delete rules based on selector id and rule id

Request Method#

GET

Path#

/plugin/rule/delete?selectorId=xxxx&&id=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
selectorIdStringtrueselector ID
idStringtruerule ID

Find Rule data List#

Get all rules by selector ID

Request Method#

GET

Path#

/plugin/rule/findList?selectorId=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
selectorIdStringtrueselector id

Meta data#

Save Or Update#

Save Or Update Meta data

Request Method#

POST

Path#

/meta/saveOrUpdate

RequestParam#
NameTypeRequiredDefaultDescription
MetaDataMetaDataTrueMetadata object (pass Json object inside Body)
MetaData
#
NameTypeRequiredDefaultDescription
idStringFalseID
appNameStringTrueapp name
contextPathStringTruecontextPath
pathStringTruepath
rpcTypeStringTruerpc type(dubbo,sofa,tars,springCloud,motan,grpc)
serviceNameStringTrueservice name
methodNameStringTruemethod name
parameterTypesStringTrueparameter types
rpcExtStringFalserpc extension parameters (json objects)
enabledBooleanFalseWhether to turn on

Delete#

Delete Meta data

Request Method#

GET

Path#

/meta/delete?rpcType=xxxx&&path=xxx

RequestParam#
NameTypeRequiredDefaultDescription
rpcTypeStringtruerpc type(dubbo,sofa,tars,springCloud,motan,grpc)
pathStringtruepath

App Sign Data#

Save Or Update#

Save Or Update App Sign Data

Request Method#

POST

Path#

/auth/saveOrUpdate

RequestParam#
NameTypeRequiredDefaultDescription
AppAuthDataAppAuthDataTrueSignature object (Json object passed inside the Body)
AppAuthData
#
NameTypeRequiredDefaultDescription
appKeyStringTrueapp key
appSecretStringTrueapp secret
enabledBooleanFalseWhether to turn on
openBooleanFalseis open
paramDataListAuthParamDatafalseParameter set, open is true when you need to pass (Json list object)
AuthPathDataAuthPathDatafalsePath collection, open is true when you need to pass (Json list object)
AuthParamData
#
NameTypeRequiredDefaultDescription
appNameStringTrueapp name
appParamStringTrueapp param
AuthPathData
#
NameTypeRequiredDefaultDescription
appNameStringTrueapp name
pathStringTruepath
enabledBooleanFalseWhether to turn on

Delete#

Delete App Sign Data

Request Method#

GET

Path#

/auth/delete?appKey=xxxx

RequestParam#
NameTypeRequiredDefaultDescription
appKeyStringtrueapp key