Creates an HTTP API.
Debugging
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:
- For mandatory resource types, indicate with a prefix of * .
- 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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
apig:CreateHttpApi | create | *HttpApi acs:apig:{#regionId}:{#accountId}:httpapi/* |
| none |
Request syntax
POST /v1/http-apis HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
body | object | No | The information about the API to be created. | |
name | string | Yes | The API name. | test-api |
description | string | No | The API description. | API for testing |
protocols | array | No | The protocols that are used to call the API. | |
string | No | The protocol. | HTTP | |
basePath | string | No | The API base path, which must start with a forward slash (/). | /v1 |
versionConfig | HttpApiVersionConfig | No | The versioning configuration of the API. | |
type | string | No | The API type. Valid values:
| Http |
ingressConfig | object | No | The HTTP Ingress configurations. | |
environmentId | string | No | The environment ID. | env-cq146allhtgk*** |
sourceId | string | No | The source ID. | src-crdddallhtgtr*** |
ingressClass | string | No | The Ingress Class for listening. | mse |
watchNamespace | string | No | The namespace for listening. | default |
overrideIngressIp | boolean | No | Specifies whether to update the address in Ingress Status. | false |
resourceGroupId | string | No | The resource group ID. | rg-aekzgvmlotionbi |
aiProtocols | array | No | The AI API protocols. Valid value:
| |
string | No | The AI API protocol. | OpenAI/v1 | |
deployConfigs | array | No | The API deployment configurations. Currently, only AI APIs support deployment configurations, and only a single deployment configuration can be passed. | |
HttpApiDeployConfig | No | The API deployment configuration. | ||
enableAuth | boolean | No | Specifies whether to enable authentication. | |
authConfig | AuthConfig | No | The authentication configurations. |
Response parameters
Examples
Sample success responses
JSON
format
{
"requestId": "A1994B10-C6A8-58FA-8347-6A08B0D4EFDE",
"code": "Ok",
"message": "success",
"data": {
"httpApiId": "api-xxx",
"name": "test-api"
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2025-01-02 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2024-11-20 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2024-11-18 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2024-09-06 | The internal configuration of the API is changed, but the call is not affected | View Change Details |