Exporting All APIs in an API Group
Function
This API is used to export definitions of APIs in a specified API group.
The basic, full, or extended Swagger definitions of APIs belonging to the API group and published in a specified environment will be imported.
URI
The following table lists the HTTP/HTTPS request method and URI of the API.
| Request Method | URI |
|---|---|
| GET | /v1/{project_id}/apigw/instances/{instance_id}/openapi?env_id={0}&group_id={1}&define={2}&version={3}&type={4} |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID, which can be obtained by the administrator on the My Credentials page. |
| instance_id | Yes | String | Instance ID, which can be obtained from the dedicated gateway information on the API Gateway console. |
| env_id/env | Yes | String | ID of the environment where APIs in a specified group have been published. Both env_id (recommended) and env can indicate an environment ID. If the two parameters are available, the value of env_id takes the precedence. |
| group_id/group | Yes | String | API group ID. Both group_id (recommended) and group can indicate a group ID. If the two parameters are available, the value of group_id takes the precedence. |
| define | No | String | Definition scope of the APIs to be exported:
The default value is base. |
| version | No | String | Version of the APIs after exporting. The default value is the current date and time. |
| type | No | String | Format for exporting API definitions. The value can be json or yaml. The default value is json. |
Response
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| swagger | Yes | String | The value is fixed at 2.0. |
| info | Yes | Object | See Table 4. |
| host | Yes | String | Subdomain name bound to the API group |
| paths | Yes | Object | See Table 5. |
| responses | Yes | Object | Common response, which can be referenced in {method}. For details, see Table 9. |
| securityDefinitions | Yes | Object | Security authentication mode definition. For details, see Table 13. |
| x-apigateway-access-controls | No | Object | Access control information. For details, see Table 23. |
| x-apigateway-ratelimits | No | Object | Request throttling information. For details, see Table 25. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| title | Yes | String | API group name |
| version | Yes | String | Version number. You can specify a version number or use the current date and time by default. |
| description | No | String | Description of the API group |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| uri | Yes | Object | API access address. For details, see Table 6. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| method | Yes | Object | API access method. For details, see Table 7. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| operationId | Yes | String | API name |
| description | No | String | API description |
| schemes | Yes | Object | API request protocol. HTTP and HTTPS are supported. |
| tags | No | Object | API tags |
| parameters | No | Object | Request parameter definitions. For details, see Table 8. |
| responses | Yes | Object | Response definition. For details, see Table 9. |
| security | No | Object | Security authentication mode. For details, see Table 10. |
| x-apigateway-access-control | No | Object | Access control policy bound to the API |
| x-apigateway-backend | No | Object | Backend information. For details, see Table 15. |
| x-apigateway-backend-policies | No | Object | Backend policy information. For details, see Table 16. |
| x-apigateway-cors | No | Boolean | Indicates whether CORS is supported. |
| x-apigateway-match-mode | No | String | Route matching mode |
| x-apigateway-ratelimit | No | String | Name of the request throttling policy bound to the API |
| x-apigateway-request-type | No | String | API type |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| maximum | No | Float | Maximum value of a number type parameter |
| minimum | No | Float | Minimum value of a number type parameter |
| maxLength | No | Integer | Maximum length of a string type parameter |
| minLength | No | Integer | Minimum length of a string type parameter |
| pattern | No | String | Regular expression of the parameter value |
| type | No | String | Parameter type |
| default | No | String | Default value |
| description | No | String | Parameter description |
| name | No | String | Parameter name |
| in | No | String | Parameter location, which can be path, header, query, formData, or body |
| required | No | Boolean | Indicates whether the parameter is required. The parameter is required when its location is path. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| default | No | Object | Default response, which will be used when no status codes are defined |
| status_code | No | Object | Response status code. For details, see Table 11. |
| x-apigateway-result-failure-sample | No | String | Example response for a failed request |
| x-apigateway-result-normal-sample | No | String | Example response for a successful request |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| apig-auth-type | No | Object | Security authentication mode. This parameter is a null array. Options:
|
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| description | No | String | Response description |
| schema | No | Object | Response body. For details, see Table 12. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| description | No | String | Response body |
| type | No | String | Body type, which can be FORM or STREAM |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | Object | Custom authorizer. For details, see Table 14. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Authentication type. apiKey is supported. |
| name | Yes | String | Name of apiKey |
| in | Yes | String | Location of apiKey |
| x-apigateway-auth-type | Yes | String | Authentication type extended based on apiKey. Authentication types AppSigv1, IAM, and IAM_NONE are supported. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Backend type. The options include HTTP, HTTP-VPC, FUNCTION, and MOCK. |
| parameters | No | Object | Backend parameters. For details, see Table 17. |
| backend_define | Yes | Object | Backend definition The following backend definitions are supported: |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Backend type. The options include HTTP, HTTP-VPC, FUNCTION, and MOCK. |
| name | Yes | String | Backend policy name |
| parameters | No | Object | Backend parameters. For details, see Table 17. |
| backend_define | Yes | Object | Backend definition The following backend definitions are supported: |
| conditions | Yes | Object | Policy conditions. For details, see Table 22. |
| effectMode | Yes | String | Effective mode of the backend policy. The options include ANY and ALL. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Parameter name, which consists of a maximum of 32 bytes, starting with a letter. Only letters, digits, periods (.), hyphens (-), and underscores (_) are allowed. The names of header parameters are not case-sensitive. |
| value | Yes | String | Parameter value, which is a parameter name if the parameter comes from a request |
| in | Yes | String | Parameter location, which can be header, query, or path |
| origin | Yes | String | Parameter mapping source. The options include REQUEST and CONSTANT. |
| description | No | String | Parameter meaning |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| address | Yes | String | Backend service address. The format is <Domain name or IP address>:[Port number] |
| scheme | Yes | String | Backend request protocol. HTTP and HTTPS are supported. |
| method | Yes | String | Backend request method. The options include GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH, and ANY. |
| path | Yes | String | Backend request path, which can contain variables. |
| timeout | No | Integer | Backend request timeout in milliseconds. The value ranges from 1 to 60,000, and the default value is 5000. |
| description | No | String | Backend description |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | Array | VPC channel name |
| scheme | Yes | String | Backend request protocol. HTTP and HTTPS are supported. |
| method | Yes | String | Backend request method. The options include GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH, and ANY. |
| path | Yes | String | Backend request path, which can contain variables. |
| timeout | No | Integer | Backend request timeout in milliseconds. The value ranges from 1 to 60,000, and the default value is 5000. |
| host | No | String | VPC channel proxy host |
| description | No | String | Backend description |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| function-urn | Yes | String | Function URN |
| version | Yes | String | Function version |
| invocation-type | Yes | String | Function invocation type. The value can be async or sync. |
| timeout | No | Integer | Function timeout in milliseconds. The value ranges from 1 to 60,000, and the default value is 5000. |
| description | No | String | Backend description |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| result-content | Yes | String | Mock response |
| description | No | String | Backend description |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| type | Yes | String | Policy condition type. The options include equal, enum, and pattern. |
| value | Yes | String | Policy condition value |
| origin | Yes | String | Policy condition source. The options include source and request. |
| parameter | No | String | Input parameter name if the origin parameter is set to request. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| acl_name | No | Object | Access control policy. For details, see Table 24. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| acl-type | Yes | String | Access control effect. The options include PERMIT and DENY. |
| entity-type | Yes | String | Access control object. Only IP addresses and accounts are supported. |
| value | Yes | String | Access control values, which are separated with commas (,). |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| throttle_name | No | Object | Request throttling policy. For details, see Table 26. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| api-limit | Yes | Integer | Maximum number of times an API can be called |
| user-limit | No | Integer | Number of times the API can be called by a user |
| app-limit | No | Integer | Number of times the API can be called by an app |
| ip-limit | No | Integer | Number of times the API can be called by an IP address |
| interval | Yes | Integer | Throttling period |
| unit | Yes | String | Throttling unit, which can be SECOND, MINUTE, HOUR, or DAY |
| shared | No | Boolean | Whether to share the throttling limits among APIs |
| special | No | Object | Excluded request throttling configurations. For details, see Table 27. |
Example response:
{
"swagger": "2.0",
"info": {
"description": "api group test",
"title": "APIGroup_test",
"version": "2019-09-12-17:38:10"
},
"host": "6b075335476a4943bf70c3db1343c912.apigw.example.com",
"paths": {
"/test/{path}": {
"get": {
"security": [
{
"apig-auth-app": []
}
],
"description": "api test",
"schemes": [
"https"
],
"operationId": "API_test",
"parameters": [
{
"type": "string",
"description": "header parameter",
"name": "header",
"in": "header",
"required": true
},
{
"type": "string",
"description": "path parameter",
"name": "path",
"in": "path",
"required": true
},
{
"type": "number",
"default": "123",
"description": "query parameter",
"name": "query",
"in": "query"
}
],
"responses": {
"default": {
"$ref": "#/responses/default"
},
"x-apigateway-result-failure-sample": "",
"x-apigateway-result-normal-sample": "success"
},
"x-apigateway-backend": {
"httpEndpoints": {
"address": "1.1.1.1:443",
"description": "",
"method": "GET",
"path": "/test/{path}",
"scheme": "https",
"timeout": 5000
},
"parameters": [
{
"description": "",
"in": "HEADER",
"name": "header",
"origin": "REQUEST",
"value": "header"
},
{
"description": "",
"in": "PATH",
"name": "path",
"origin": "REQUEST",
"value": "path"
},
{
"description": "",
"in": "QUERY",
"name": "query",
"origin": "REQUEST",
"value": "query"
}
],
"type": "HTTP"
},
"x-apigateway-backend-policies": [
{
"conditions": [
{
"origin": "param",
"parameter": "path",
"type": "exact",
"value": "path"
},
{
"origin": "source",
"parameter": "",
"type": "",
"value": "1.0.0.0/8"
}
],
"effectMode": "ANY",
"httpVpcEndpoints": {
"method": "POST",
"name": "VPC_n9ct",
"path": "/",
"scheme": "HTTPS",
"timeout": 5000
},
"name": "policy_test",
"type": "HTTP-VPC"
}
],
"x-apigateway-cors": false,
"x-apigateway-match-mode": "NORMAL",
"x-apigateway-request-type": "public"
}
}
},
"responses": {
"default": {
"description": "response example"
}
},
"securityDefinitions": {
"apig-auth-app": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"x-apigateway-auth-type": "AppSigv1"
},
"apig-auth-app-header": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"x-apigateway-auth-opt": {
"appcode-auth-type": "header"
},
"x-apigateway-auth-type": "AppSigv1"
},
"apig-auth-iam": {
"type": "apiKey",
"name": "unused",
"in": "header",
"x-apigateway-auth-type": "IAM"
}
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | bad request |
| 401 | unauthorized |
| 403 | forbidden |
| 500 | server internal error |
Last Article: API Import and Export
Next Article: Exporting Multiple APIs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.