Creates a route for an HTTP API.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
apig:CreateHttpApiRoute |
none |
*HttpApi
|
None | None |
Request syntax
POST /v1/http-apis/{httpApiId}/routes HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| httpApiId |
string |
No |
The ID of the HTTP API to which the route belongs. |
api-cqoob7llhtgq*** |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. |
|
| environmentId |
string |
No |
The environment ID. |
env-cpqnr6tlhtgubcv*** |
| name |
string |
No |
The route name. |
login |
| description |
string |
No |
The route description. |
用户登录路由。 |
| domainIds |
array |
No |
The domain name IDs. |
|
|
string |
No |
The domain name IDs. |
d-cr62ts5lhtglnu*** |
|
| match | HttpRouteMatch |
No |
The route match rule. |
|
| backendConfig |
object |
No |
The backend service configuration of the route. |
|
| scene |
string |
No |
The backend service scenario. Valid values:
Valid values:
|
SingleService |
| services |
array<object> |
No |
The list of backend services. |
|
|
object |
No |
The backend service. |
||
| serviceId |
string |
No |
The service ID. |
svc-crbgq0dlhtgr*** |
| protocol |
string |
No |
The service protocol. Valid values:
Valid values:
|
HTTP |
| port |
integer |
No |
The service port. Do not specify this parameter for dynamic ports. |
8080 |
| weight |
integer |
No |
The percentage value of the traffic ratio. |
49 |
| version |
string |
No |
The service version. This parameter is valid only in the tag-based scenario. |
v1 |
| deployConfigs |
array |
No |
The API deployment configurations. |
|
| HttpApiDeployConfig |
No |
The API deployment configurations. |
||
| mcpRouteConfig |
object |
No |
The MCP route configuration. |
|
| protocol |
string |
No |
The service protocol. Valid values:
|
HTTP,HTTPS |
| exposedUriPath |
string |
No |
The exposed URI path. |
/v1/chat/completions |
| mcpStatisticsEnable |
boolean |
No |
Specifies whether to enable MCP observability. Default value: false. |
false |
| policyConfigs |
array |
No |
The policy type. |
|
| HttpApiPolicyConfigs |
No |
The policy type. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
3ACFC7A7-45A9-58CF-B2D5-765B60254695 |
| code |
string |
The response status code. |
Ok |
| message |
string |
The response message. |
success |
| data |
object |
The response data. |
|
| routeId |
string |
The route ID. |
hr-cr82undlhtgrlej*** |
Examples
Success response
JSON format
{
"requestId": "3ACFC7A7-45A9-58CF-B2D5-765B60254695",
"code": "Ok",
"message": "success",
"data": {
"routeId": "hr-cr82undlhtgrlej***"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.