Imports OpenAPI Specification (OAS)-compliant data to create an API.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
apigateway:ImportOAS |
create |
*ApiGroup
|
None | 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 elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| OperationId |
string |
The ID of the asynchronous API import task that was generated during the import operation. This ID is used to query the execution status of the API import task. |
c16a1880f5164d779f6a54f64d997cd9 |
| RequestId |
string |
The ID of the request. |
E7FE7172-AA75-5880-B6F7-C00893E9BC06 |
| ErrorMessages |
object |
||
| ErrorMessage |
array |
The error messages that appear due to the invalid data in the imported file. |
|
|
string |
The error message that appears due to the invalid data in the imported file. |
Invalid extensions:x-aliyun-apigateway-auth-type. Option value [ANONYMOUS, APP]. |
|
| WarningMessages |
object |
||
| WarningMessage |
array |
The warning messages that appear due to the invalid data in the imported file. |
|
|
string |
The warning message that appears due to the invalid data in the imported file. |
There is no valid api definition in your file. |
|
| SuccessApis |
object |
||
| SuccessApi |
array<object> |
The information about the APIs that have passed the precheck. |
|
|
object |
The information about the API that has passed the precheck. |
||
| Path |
string |
The request path configured when you created the API. |
/st1 |
| HttpMethod |
string |
The HTTP method configured when you created the API. |
POST |
| ApiId |
string |
The ID of the API. |
92af1abffc2443eaa2b815fdbd9c13f1 |
| ApiOperation |
string |
Indicates that the operation is CREATE or MODIFY. |
CREATE |
| FailedApis |
object |
||
| FailedApi |
array<object> |
The APIs that failed to pass the precheck. |
|
|
object |
The API that failed to be pass the precheck. |
||
| Path |
string |
The request path configured when you created the API. |
/st1 |
| HttpMethod |
string |
The HTTP method configured when you created the API. |
POST |
| ErrorMsg |
string |
The error message. |
Invalid Api Definition. |
| FailedModels |
object |
||
| FailedModel |
array<object> |
The information about the models that failed to pass the precheck. |
|
|
object |
The information about the model that failed to pass the precheck. |
||
| ErrorMsg |
string |
The error message. |
Invalid Model Definition. |
| ModelName |
string |
The name of the model. |
test |
| GroupId |
string |
The ID of the API group. |
2c1bc62e19614cc68c6b0b484bc9c5db |
| SuccessModels |
object |
||
| SuccessModel |
array<object> |
The information about the models that have passed the precheck. |
|
|
object |
The information about the model that has passed the precheck. |
||
| ModelUid |
string |
The UID of the model. |
1r4efwee19614cc68c6b0b484bc9c5dbs |
| ModelName |
string |
The name of the model. |
test |
| GroupId |
string |
The ID of the API group. |
feaccf67040643bcbdedb253e59eb527 |
| ModelOperation |
string |
The operation of the model. Valid values: CREATE and MODIFY. |
CREATE |
Examples
Success response
JSON format
{
"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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.