Creates an HTTP API.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
apig:CreateHttpApi |
create |
*HttpApi
|
None | None |
Request syntax
POST /v1/http-apis HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. |
{'key': 'value'} |
| name |
string |
Yes |
The API name. |
test-api |
| description |
string |
No |
The API description. |
Test API for integration |
| protocols |
array |
No |
The list of API access protocols. |
|
|
string |
No |
The API access protocol. Valid values:
|
HTTP |
|
| basePath |
string |
No |
The API base path. The path must start with a forward slash (/), cannot exceed 256 bytes in length, and cannot contain spaces. This parameter is required when type is set to Rest. When type is set to LLM, Ai, or Agent, this parameter is optional and defaults to /. |
/v1 |
| versionConfig | HttpApiVersionConfig |
No |
The API versioning configuration. |
|
| type |
string |
Yes |
The type of the HTTP API. Valid values:
Valid values:
|
Http |
| ingressConfig |
object |
No |
The HTTP Ingress API configuration. This parameter is required and cannot be nil when type is set to HttpIngress. This parameter is not required for other types. |
|
| environmentId |
string |
No |
The environment ID. |
env-cq146allhtgk*** |
sourceId
deprecated
|
string |
No |
The source ID. |
src-crdddallhtgtr*** |
| ingressClass |
string |
No |
The Ingress Class to listen on. |
mse |
| watchNamespace |
string |
No |
The namespace to listen on. |
default |
| overrideIngressIp |
boolean |
No |
Specifies whether to update the address in the Ingress Status. |
false |
| clusterId |
string |
No |
The cluster ID. |
k7v5eobfzttudni2pw*** |
| resourceGroupId |
string |
No |
The resource group ID. |
rg-xxx |
| aiProtocols |
array |
No |
The AI API protocols. This parameter is required when type is set to LLM, and only one protocol can be specified. This parameter is required when type is set to Ai, and multiple protocols can be specified. This parameter is not required for other types. |
|
|
string |
No |
The AI API protocol. |
OpenAI/v1 |
|
| agentProtocols |
array |
No |
The list of protocols supported by the agent. This parameter is required when type is set to Agent. This parameter is not required for other types. |
|
|
string |
No |
The list of protocols supported by the agent. This parameter is required when type is set to Agent. This parameter is not required for other types. |
http/https |
|
| deployConfigs |
array |
No |
The API deployment configurations. This parameter is required when type is set to LLM or Ai, and only one deployment configuration can be specified. This parameter is not validated at the request level for other types. |
|
| HttpApiDeployConfig |
No |
The API deployment configuration. |
||
| enableAuth |
boolean |
No |
Specifies whether to enable authentication. This parameter is validated when type is set to LLM, Ai, or Agent. This parameter is not validated at the request level when type is set to Rest. |
true |
| authConfig | AuthConfig |
No |
The authentication configuration. This parameter is required when enableAuth is set to true. |
|
| modelCategory |
string |
No |
The model category. This parameter is optional when type is set to LLM or Ai. This parameter is not required for other types. Valid values:
|
Text |
| removeBasePathOnForward |
boolean |
No |
Specifies whether to remove the base path when forwarding requests. |
true |
| firstByteTimeout |
integer |
No |
The timeout period for waiting for the first byte from the backend. |
30 |
| belongGatewayId |
string |
No |
The ID of the gateway to which the API belongs. |
gw-abc123xyz789 |
dryRun
deprecated
|
boolean |
No |
Specifies whether to perform a dry run without executing the operation. |
true |
| strategy |
string |
No |
The conflict merge strategy for import. |
ExistFirst |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| requestId |
string |
The request ID. |
A1994B10-C6A8-58FA-8347-6A08B0D4EFDE |
| code |
string |
The status code. |
Ok |
| message |
string |
The response message. |
success |
| data |
object |
The API information. |
|
| httpApiId |
string |
HTTP API ID。 |
api-xxx |
| name |
string |
The API name. |
test-api |
Examples
Success response
JSON format
{
"requestId": "A1994B10-C6A8-58FA-8347-6A08B0D4EFDE",
"code": "Ok",
"message": "success",
"data": {
"httpApiId": "api-xxx",
"name": "test-api"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.