Help Center/ API Gateway/ API Reference (Paris Region)/ Shared Gateway APIs/ API Management/ Publishing Multiple APIs or Taking Multiple APIs Offline
Updated on 2022-02-21 GMT+08:00

Publishing Multiple APIs or Taking Multiple APIs Offline

Function

This API is used to publish multiple APIs in an environment or to remove multiple APIs from the environment in which they have been published.

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

POST

/v1.0/apigw/apis/publish[?action]

The following table lists the parameter in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

action

No

String

online: publish

offline: take offline

Request

Table 3 Parameter description

Parameter

Mandatory

Type

Description

apis

Yes

String Array

IDs of the APIs to be published or taken offline

env_id

Yes

String

Environment ID

remark

No

String

Description of the publication

The description cannot exceed 255 characters.

Example request:

{
	"apis": ["81efcfd94b8747a0b21e8c04144a4e8c","7addcd00cfab433984b1d8bf2fe08aaa"],
	"env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
  "remark": "Published in the production environment"
}

Response

Table 4 Parameter description

Parameter

Type

Description

success

Array

Message for successful API publication or taking offline

failure

Array

Error message and APIs that fail to be published or taken offline

Table 5 Parameter description of success (batch publishing)

Parameter

Type

Description

publish_id

String

Publication record ID

api_id

String

ID of a successfully published API

api_name

String

Name of the API

env_id

String

ID of the environment in which the API has been published

remark

String

Description of the publication

publish_time

Timestamp

Time when the API is published

version_id

String

API version

Table 6 Parameter description of success (taking offline in batches)

Parameter

Type

Description

api_id

String

ID of an API that is successfully taken offline

api_name

String

Name of the API

Table 7 Parameter description of failure

Parameter

Type

Description

api_id

String

ID of an API that fails to be published or taken offline

api_name

String

Name of the API

error_code

String

Error code

error_msg

String

Error message

Example response:

{
	"success": [{
		"publish_id": "5b729aa252764739be2c37ef0d66dc63",
		"api_id": "7addcd00cfab433984b1d8bf2fe08aaa",
                "api_name": "testApi",
		"env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
		"version_id": "3d9dcb733ba34352b0d02f85fd16b026",
		"remark": "string",
		"publish_time": "2018-07-26T13:18:04.1079916Z"
	}],
	"failure": [{
		"api_id": "81efcfd94b8747a0b21e8c04144a4e8c",
		"error_code": "APIG.3002",
		"error_msg": "api with id 81efcfd94b8747a0b21e8c04144a4e8c not found"
	}]
}

Status Codes

Table 8 Status codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error