Imports OpenAPI Specification (OAS)-compliant data to create an 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 Resourcesis 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 |
|---|---|---|---|---|
| apigateway:ImportOAS | create | *ApiGroup acs:apigateway:{#regionId}:{#accountId}:apigroup/{#GroupId} |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| GroupId | string | Yes | The ID of the API group. | 08ae4aa0f95e4321849ee57f4e0b3077 |
| Data | string | Yes | The OAS-compliant text file or OSS object URL. | swagger: "2.0" info: version: "1.0.0" title: "Swagger Petstore 2.0" basePath: "/" schemes: - "https" - "http" paths: /pet/findByStatus: get: tags: - "pet" summary: "Finds Pets by status" operationId: "findPetsByStatus" parameters: - name: "status" in: "query" required: true type: "array" items: type: "string" enum: - "available" - "pending" - "sold" default: "available" collectionFormat: "multi" responses: "200": description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Pet" "400": description: "Invalid status value" definitions: Category: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" Tag: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" Pet: type: "object" required: - "name" - "photoUrls" properties: id: type: "integer" format: "int64" category: $ref: "#/definitions/Category" name: type: "string" example: "doggie" photoUrls: type: "array" items: type: "string" tags: type: "array" items: $ref: "#/definitions/Tag" status: type: "string" description: "pet status in the store" enum: - "available" - "pending" - "sold" |
| Overwrite | boolean | Yes | Specifies whether to overwrite an existing API. If an existing API has the same HTTP request type and backend request path as the API to be imported, the existing API is overwritten. | true |
| IgnoreWarning | boolean | No | Specifies whether to ignore alerts. | true |
| SkipDryRun | boolean | No | Specifies whether to directly import the API without performing a precheck. | true |
| OASVersion | string | No | The OAS version. | OAS2 |
| BackendName | string | No | The name of the backend service. | testBackendService |
| AuthType | string | No | The security authentication method of the API. Valid values:
| APP |
| RequestMode | string | No | The request mode. Valid values:
| PASSTHROUGH |
Response parameters
Examples
Sample success responses
JSONformat
{
"OperationId": "c16a1880f5164d779f6a54f64d997cd9",
"RequestId": "E7FE7172-AA75-5880-B6F7-C00893E9BC06",
"ErrorMessages": {
"ErrorMessage": [
"Invalid extensions:x-aliyun-apigateway-auth-type. Option value [ANONYMOUS, APP]."
]
},
"WarningMessages": {
"WarningMessage": [
"There is no valid api definition in your file."
]
},
"SuccessApis": {
"SuccessApi": [
{
"Path": "/st1",
"HttpMethod": "POST",
"ApiId": "92af1abffc2443eaa2b815fdbd9c13f1",
"ApiOperation": "CREATE"
}
]
},
"FailedApis": {
"FailedApi": [
{
"Path": "/st1",
"HttpMethod": "POST",
"ErrorMsg": "Invalid Api Definition."
}
]
},
"FailedModels": {
"FailedModel": [
{
"ErrorMsg": "Invalid Model Definition.",
"ModelName": "test",
"GroupId": "2c1bc62e19614cc68c6b0b484bc9c5db"
}
]
},
"SuccessModels": {
"SuccessModel": [
{
"ModelUid": "1r4efwee19614cc68c6b0b484bc9c5dbs",
"ModelName": "test",
"GroupId": "feaccf67040643bcbdedb253e59eb527",
"ModelOperation": "CREATE"
}
]
}
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2022-11-16 | Add Operation | View Change Details |
