CreateApi
Creates an API.
Operation description
This operation is intended for users of open APIs.
API names must be unique within the same group.
Paths must be unique within the same group.
The QPS limit for this operation is 50 per user.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
apigateway:CreateApi |
create |
*ApiGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| GroupId |
string |
Yes |
The ID of the group. |
08ae4aa0f95e4321849ee57f4e0b3077 |
| ApiName |
string |
Yes |
The name of the API. The name must be unique within the group. The name can contain letters, digits, underscores (_), and Chinese characters, and must start with a letter or a Chinese character. The name must be 4 to 50 characters in length. |
ApiName |
| Visibility |
string |
Yes |
Specifies whether the API is public. Valid values:
|
PUBLIC |
| Description |
string |
No |
The description of the API. The description can be up to 180 characters in length. |
Api description |
| AuthType |
string |
No |
The security authentication type of the API. Valid values:
|
APP |
| RequestConfig |
string |
Yes |
The configurations of API requests sent by consumers to API Gateway. For more information, see RequestConfig. |
{"RequestProtocol":"HTTP","RequestHttpMethod":"GET","RequestPath":"/v3/getUserTest/[userId]","BodyFormat":"FORM","PostBodyDescription":""} |
| ServiceConfig |
string |
Yes |
The configurations of API requests sent by API Gateway to the backend service. For more information, see ServiceConfig. |
{"ServiceProtocol":"HTTP","ServiceHttpMethod":"GET","ServiceAddress":"http://www.customerdomain.com","ServiceTimeout":"1000","ServicePath":"/v3/getUserTest/[userId]"} |
| RequestParameters |
string |
No |
The descriptions of the parameters in API requests sent by consumers to API Gateway. For more information, see RequestParameter. |
[ { "ParameterLocation": { "name": "Head", "orderNumber": 2 }, "ParameterType": "String", "Required": "OPTIONAL", "isHide": false, "ApiParameterName": "header1", "DefaultValue": "123124", "Location": "Head" }, { "ParameterLocation": { "name": "Head", "orderNumber": 2 }, "ParameterType": "String", "Required": "REQUIRED", "isHide": false, "ApiParameterName": "header2", "DefaultValue": "", "Location": "Head" }, { "ParameterLocation": { "name": "Query", "orderNumber": 3 }, "ParameterType": "String", "Required": "OPTIONAL", "isHide": false, "ApiParameterName": "query1", "DefaultValue": "1245", "Location": "Query" }, { "ApiParameterName": "CaClientIp", "ParameterLocation": { "name": "Query", "orderNumber": 0 }, "Location": "Query", "ParameterType": "String", "Required": "REQUIRED", "Description": "ClientIP" }, { "ApiParameterName": "testConstant", "ParameterLocation": { "name": "Head", "orderNumber": 0 }, "Location": "Head", "ParameterType": "String", "Required": "REQUIRED", "DefaultValue": "111" } ] |
| SystemParameters |
string |
No |
The system parameters sent by API Gateway to the backend service. |
[{\"location\":\"HEAD\",\"parameterName\":\"CaDomain\",\"serviceParameterName\":\"host\"}] |
| ConstantParameters |
string |
No |
The constant parameters sent by API Gateway to the backend service. |
[{\"ConstantValue\":\"123\",\"Description\":\"Constant parameter\",\"Location\":\"HEAD\",\"ServiceParameterName\":\"test\"}] |
| ServiceParameters |
string |
No |
The descriptions of the parameters in API requests sent by API Gateway to the backend service. For more information, see ServiceParameter. |
[ { "ServiceParameterName": "header1", "Location": "Head", "Type": "String", "ParameterCatalog": "REQUEST" }, { "ServiceParameterName": "header2", "Location": "Query", "Type": "String", "ParameterCatalog": "REQUEST" }, { "ServiceParameterName": "query1", "Location": "Head", "Type": "String", "ParameterCatalog": "REQUEST" }, { "ServiceParameterName": "ipp", "Location": "Query", "Type": "String", "ParameterCatalog": "SYSTEM" }, { "ServiceParameterName": "testConstant", "Location": "Head", "Type": "String", "ParameterCatalog": "CONSTANT" } ] |
| ServiceParametersMap |
string |
No |
The mappings between the parameters in requests sent by consumers to API Gateway and the parameters in requests sent by API Gateway to the backend service. For more information, see ServiceParameterMap. |
[ { "ServiceParameterName": "header1", "RequestParameterName": "header1" }, { "ServiceParameterName": "header2", "RequestParameterName": "header2" }, { "ServiceParameterName": "query1", "RequestParameterName": "query1" }, { "ServiceParameterName": "ipp", "RequestParameterName": "CaClientIp" }, { "ServiceParameterName": "testConstant", "RequestParameterName": "testConstant" } ] |
| ResultType |
string |
No |
The format of the response returned by the backend service. Valid values: JSON, TEXT, BINARY, XML, and HTML. Default value: JSON. |
HTML |
| ResultSample |
string |
No |
The sample success response returned by the backend service. This value is used only to generate documentation and does not affect the actual response. Maximum size: 32 KB. |
{} |
| FailResultSample |
string |
No |
The sample error response returned by the backend service. This value is used only to generate documentation and does not affect the actual response. Maximum size: 16 KB. |
{\"requestId\":\"3b9b8b31-93c3-489e-8ebb-cab35a1aee51\",\"errCode\":500,\"errMsg\":\"connection refused\"} |
| ErrorCodeSamples |
string |
No |
The sample error codes returned by the backend service. For more information, see ErrorCodeSample. |
[{\"Code\":\"400\",\"Message\":\"Login failed\",\"Description\":\"Invalid user name or password\"}] |
| ResultDescriptions |
string |
No |
The description of the API response. |
{} |
| OpenIdConnectConfig |
string |
No |
The status of the IP access control feature. Valid values:
|
{\"openIdApiType\":null,\"idTokenParamName\":null,\"publicKeyId\":null,\"publicKey\":null} |
| AllowSignatureMethod |
string |
No |
The signature algorithm. This parameter is required when AuthType is set to APP. Valid values:
|
HmacSHA256 |
| WebSocketApiType |
string |
No |
The type of the bidirectional communication API. Valid values:
|
COMMON |
| ResultBodyModel |
string |
No |
The response body model of the API. |
{} |
| ForceNonceCheck |
boolean |
No |
|
true |
| DisableInternet |
boolean |
No |
|
true |
| AppCodeAuthType |
string |
No |
The AppCode authentication type. This parameter is valid when AuthType is set to APP. Valid values:
|
HEADER |
| BackendId |
string |
No |
The ID of the backend service. |
a0305308908c4740aba9cbfd63ba99b7 |
| BackendEnable |
boolean |
No |
Specifies whether to enable the backend service. |
true |
| Tag |
array<object> |
No |
The tags of the object to which the rule applies. You can specify multiple tags. |
|
|
object |
No |
|||
| Key |
string |
No |
The key of the tag. |
env |
| Value |
string |
No |
The value of the tag. |
value |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| ApiId |
string |
The ID of the created API. |
8afff6c8c4c6447abb035812e4d66b65 |
| RequestId |
string |
The ID of the request. |
6C87A26A-6A18-4B8E-8099-705278381A2C |
Examples
Success response
JSON format
{
"ApiId": "8afff6c8c4c6447abb035812e4d66b65",
"RequestId": "6C87A26A-6A18-4B8E-8099-705278381A2C"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.