Updated on 2022-12-06 GMT+08:00

Querying Historical API Versions

Function

This API is used to query the historical versions of an API. APIG retains a maximum of 10 historical versions for each API in an environment.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

GET

/v1.0/apigw/apis/publish/{api_id}[?env_id,env_name]

  • A combination of different query conditions can be added at the end of the URI by using question marks (?) and ampersands (&).
  • Query conditions include: env_id and env_name.

The following table lists the parameters in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

api_id

Yes

String

API ID

env_id

No

String

ID of the environment in which the API has been published

env_name

No

String

Name of the environment in which the API has been published

Request

N/A

Response

Table 3 Parameter description

Parameter

Type

Description

total

Integer

Number of historical versions that match the query conditions

size

Integer

Length of the returned historical version list

api_versions

Dictionary

Historical version list

Table 4 Parameter description of api_versions

Parameter

Type

Description

version_id

String

API version ID

version_no

String

API version

api_id

String

API ID

env_id

String

ID of the environment in which the API has been published

env_name

String

Name of the environment in which the API has been published

remark

String

Description about the publication

publish_time

Timestamp

Time when the API is published

status

Integer

Version status, which can be:

  • Effective
  • Not effective

Example response:

{
  "total": 1,
  "size": 1,
  "api_versions": [
    {
      "version_id": "04c194dc7b5340ed942f2451702060da",
      "version_no": "20180722102526",
      "api_id": "acf141aa6279415088b593a4bbb55eed",
      "env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
      "env_name": "RELEASE",
      "publish_time": "2018-04-14T07:32:23Z",
      "status": 2
    }
  ]
}

Status Codes

Table 5 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error