All Products
Search
Document Center

Microservices Engine:AddGatewayRoute

Last Updated:Aug 12, 2024

Adds a gateway route.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
mse:AddGatewayRoute
  • Gateway
    acs:mse:{#regionId}:{#accountId}:instance/{#GatewayUniqueId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
GatewayIdlongNo

The ID of the gateway.

526
NamestringYes

The name of the route.

test
RouteOrderintegerNo

The sequence number of the route. (A small value indicates a high priority.)

1
PredicatesobjectNo

The matching rule.

PathPredicatesobjectNo

The information about route matching.

PathstringNo

The path.

/test
TypestringNo

The route matching type. Valid values:

  • PRE: prefix matching
  • EQUAL: exact matching
  • ERGULAR: regular expression matching
PRE
IgnoreCasebooleanNo

Specifies whether to ignore case sensitivity.

true
MethodPredicatesarrayNo

The information about method matching.

stringNo

The method.

GET
HeaderPredicatesarray<object>No

The information about header matching.

objectNo

The request header.

KeystringNo

The key of the request header.

debug
ValuestringNo

The value of the request header.

test
TypestringNo

The matching type.

PRE
QueryPredicatesarray<object>No

The information about URL parameter matching.

objectNo

The information about the URL parameter.

KeystringNo

The name of the parameter.

userid
ValuestringNo

The value of the parameter.

test
TypestringNo

The matching type.

PRE
Servicesarray<object>No

The list of services.

objectNo

The list of services.

ServiceIdlongNo

The ID of the service.

353
PercentintegerNo

The weight in the form of a percentage value.

80
VersionstringNo

The version of the service.

v1
NamestringNo

The name.

user
SourceTypestringNo

The source type.

MSE
NamespacestringNo

The namespace to which the service belongs.

default
GroupNamestringNo

The name of the group to which the service belongs.

test
AgreementTypestringNo

The type of the protocol.

DUBBO
HttpDubboTranscoderobjectNo

The transcoder of the Dubbo protocol.

DubboServiceNamestringNo

The name of the Dubbo service.

org.apache.dubbo.samples.basic.api.DemoService
DubboServiceVersionstringNo

The version of the Dubbo service.

0.0.0
DubboServiceGroupstringNo

The name of the service group.

None
MothedMapListarray<object>No

The forwarding rules of the Dubbo service.

objectNo

The method mapping.

DubboMothedNamestringNo

The method name of the Dubbo service.

sayHello
HttpMothedstringNo

The HTTP method.

Note Valid values:
  • ALL_GET

  • ALL_POST

  • ALL_PUT

  • ALL_DELETE

  • ALL_PATCH

ALL_GET
MothedpathstringNo

The path used for method matching.

/mytestzbk/sayhello
PassThroughAllHeadersstringNo

The pass-through type of the header.

Note Valid values:
  • PASS_ALL: All headers are passed through.

  • PASS_NOT: All headers are not passed through.

  • PASS_ASSIGN: Specified headers are passed through.

PASS_NOT
PassThroughListarrayNo

The list of headers to be passed through.

stringNo

The value of the header to be passed through.

x-forward
ParamMapsListarray<object>No

The information about parameter mappings.

objectNo

The parameter mapping object.

ExtractKeySpecstringNo

The position of the input parameter.

Note Valid values:
  • ALL_QUERY_PARAMETER: request parameter

  • ALL_HEADER: request header

  • ALL_PATH: request path

  • ALL_BODY: request body

ALL_QUERY_PARAMETER
ExtractKeystringNo

The key extracted from the input parameter.

name
MappingTypestringNo

The type of the backend service parameter.

java.lang.String
ServicePortintegerNo

The service port number.

443
DomainIdlongNo

The domain ID.

20
DestinationTypestringNo

The type of the destination service. Valid values:

  • Single
  • Multiple
  • VersionOriented
  • Mock
  • Redirect
Multiple
DirectResponseJSONobjectNo

The mock response configuration.

CodelongNo

The mock return code.

403
BodystringNo

The mock return value.

hello
GatewayUniqueIdstringYes

The unique ID of the gateway.

gw-492af9b04bb4474cae9d645be8*****
DomainIdListJSONstringYes

The domain IDs.

[0,94]
RedirectJSONobjectNo

The configuration of the redirection.

CodeintegerNo

The status code returned.

302
HoststringNo

The hostname to be redirected to.

test.com
PathstringNo

The path to be redirected to.

/test
EnableWafbooleanNo

Specifies whether to activate Web Application Firewall (WAF).

true
FallbackbooleanNo

Specifies whether to enable the Fallback service.

true
FallbackServicesarray<object>No

The information about the Fallback service.

objectNo
ServiceIdlongNo

The ID of the service.

353
PercentintegerNo

The weight in the form of a percentage value.

80
VersionstringNo

The version of the service.

v1
NamestringNo

The name.

user
SourceTypestringNo

The source type.

MSE
NamespacestringNo

The namespace to which the service belongs.

default
GroupNamestringNo

The name of the group to which the service belongs.

test
AgreementTypestringNo

The type of the protocol.

DUBBO
ServicePortintegerNo

The service port number.

443
RouteTypestringNo

The route type. Valid values:

Op: Manage routes.

Op
PoliciesstringNo

The routing policy in a JSON string.

{"CORS":"{\"allowMethods\":\"GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH\",\"allowHeaders\":\"*\",\"exposeHeaders\":\"*\",\"unitNum\":12,\"allowCredentials\":true,\"status\":\"off\",\"allowOrigins\":\"*\",\"timeUnit\":\"h\"}","Timeout":"{\"unitNum\":10,\"timeUnit\":\"s\",\"status\":\"off\"}","Retry":"{\"attempts\":2,\"retryOn\":[\"5xx\"],\"status\":\"off\"}","HTTPRewrite":"{\"pathType\":\"EQUAL\",\"path\":\"/o\",\"status\":\"off\"}","Waf":"{\"enabled\":false}","HeaderOp":"{\"status\":\"off\",\"headerOpItems\":[{\"directionType\":\"Request\",\"opType\":\"Add\",\"key\":\"kkk\",\"value\":\"ll\"}]}"}
AcceptLanguagestringNo

The language of the response. Valid values:

  • zh: Chinese
  • en: English
zh

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The ID of the request.

03A3E2F4-6804-5663-9D5D-2EC47A1*****
HttpStatusCodeinteger

The HTTP status code returned.

200
Messagestring

The message returned.

The request is successfully processed.
Codeinteger

The status code returned.

200
Successboolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true
Datalong

The ID of the created route.

555
ErrorCodestring

The error code that is returned.

  • InvalidParameter: The parameter is invalid. For example, the parameter is incomplete or the parameter format is invalid.
  • IllegalRequest: The request is invalid. Unauthorized access to data initiated by parameters is identified.
  • NoPermission: You are not authorized to perform this operation.
  • NotFound: The resource does not exist and error 404 is returned.
  • InternalError: An internal error occurred.
InvalidParameter

Examples

Sample success responses

JSONformat

{
  "RequestId": "03A3E2F4-6804-5663-9D5D-2EC47A1*****",
  "HttpStatusCode": 200,
  "Message": "The request is successfully processed.\n",
  "Code": 200,
  "Success": true,
  "Data": 555,
  "ErrorCode": "InvalidParameter"
}

Error codes

HTTP status codeError codeError messageDescription
400IllegalRequestInvalid request:%sInvalid request: %s
400InvalidParameterParameter error:%sRequest parameter error: %s
403NoPermissionYou are not authorized to perform this operation:%sYou do not have the permission to use this interface:%s
404NotFoundNot found:%sThe resource does not exist:%s
500InternalErrorConsole error. Try again later:%sConsole error. Try again later: %s

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-18The request parameters of the API has changedView Change Details
2023-03-31The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-03-02The request parameters of the API has changedView Change Details
2022-07-28The internal configuration of the API is changed, but the call is not affectedView Change Details
2022-02-18Add OperationView Change Details