Available in Classic and VPC
Publish or unpublish an API.
Request
This section describes the request format. The method and URI are as follows:
| Method | URI |
|---|---|
| POST | /api/v1/products/{product-id}/apis/{api-id}/publish |
Request headers
For information about the headers common to all API Gateways, see API Gateway request headers.
Request path parameters
You can use the following path parameters with your request:
| Field | Type | Required | Description |
|---|---|---|---|
product-id |
String | Required | Product ID connected to the API |
api-id |
String | Required | API ID generated in the product |
Request syntax
The request syntax is as follows:
{
"stages" : [ {
"isPublished" : true,
"stageId" : "stageId"
} ]
}
Request body
You can include the following data in the body of your request:
| Field | Type | Required | Description |
|---|---|---|---|
stages |
Array | Required | Publishing settings information: stages |
stages
The following describes stages.
| Field | Type | Required | Description |
|---|---|---|---|
isPublished |
Boolean | Required | Select whether to publish
|
stageId |
String | Required | Stage ID to publish or unpublish API |
Request example
The request example is as follows:
curl -X POST 'https://apigateway.apigw.ntruss.com/api/v1/products/{product-id}/apis/{api-id}/publish' \
--header 'Content-Type: application/json' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--data '{
"stages" : [ {
"isPublished" : true,
"stageId" : "*****7mhdv"
} ]
}'
Response
This section describes the response format.
Response status codes
For information about the HTTP status codes common to all API Gateways, see API Gateway response status codes.