Updated on 2022-02-21 GMT+08:00

Publishing an API

Function

This API is used to publish an API in a specified environment. An API can be called in an environment only after it is published in it. APIs that have not been published cannot be called.

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/{api_id}

The following table lists the parameter in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

api_id

Yes

String

API ID

Request

Table 3 Parameter description

Parameter

Mandatory

Type

Description

env_id

Yes

String

ID of the environment in which the API will be published

remark

No

String

Description about the publication

The description cannot exceed 255 characters.

Example request:

{
	"env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
	"remark": "Published in the production environment"
}

Response

Table 4 Parameter description

Parameter

Type

Description

publish_id

String

ID of the publication record

api_id

String

API ID

env_id

String

ID 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

version_id

String

API version

Example response:

{
  "publish_id": "5b729aa252764739be2c37ef0d66dc63",
  "api_id": "7addcd00cfab433984b1d8bf2fe08aaa",
  "env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
  "version_id": "3d9dcb733ba34352b0d02f85fd16b026",
  "remark": "string",
  "publish_time": "2018-07-26T13:18:04.1079916Z"
}

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