Previews
Every /v1 route for previews. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.
Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.
One preview
GET /v1/previews/{previewId}
Key scopes: READ and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
previewId | string | yes | The preview's id. |
Returns
200withV1PrPreview.
bash
curl "https://api.naijacloud.com/v1/previews/$PREVIEW_ID" \
-H "Authorization: Bearer $NC_API_KEY"Tear a preview down now
DELETE /v1/previews/{previewId}
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
previewId | string | yes | The preview's id. |
Returns
200withV1PrPreview.
bash
curl -X DELETE "https://api.naijacloud.com/v1/previews/$PREVIEW_ID" \
-H "Authorization: Bearer $NC_API_KEY"A service's pull-request previews
GET /v1/services/{serviceId}/previews
Key scopes: READ and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Query parameters
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | Rows per page. Ignored when a cursor is given. |
cursor | string | no | The nextCursor of the previous page, unchanged. |
Returns
200with a page:{ data: V1PrPreview[], nextCursor }, where each item isV1PrPreview.
bash
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/previews" \
-H "Authorization: Bearer $NC_API_KEY"Turn pull-request previews on or off
PUT /v1/services/{serviceId}/previews-enabled
Key scopes: WRITE and PLATFORM_API.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
serviceId | string | yes | The service's id. |
Body
| Field | Type | Required | Notes |
|---|---|---|---|
enabled | boolean | yes | Open a preview environment for every pull request. |
Returns
204with no body.
bash
curl -X PUT "https://api.naijacloud.com/v1/services/$SERVICE_ID/previews-enabled" \
-H "Authorization: Bearer $NC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'Types
V1PrPreview
| Field | Type | Notes |
|---|---|---|
authorLogin | string, or null | |
baseRef | string, or null | |
createdAt | string (date-time) | |
environmentId | string, or null | |
error | string, or null | |
headRef | string | |
headSha | string, or null | |
id | string | |
lastDeploymentId | string, or null | |
prNumber | integer | |
previewPostgresServiceId | string, or null | |
previewWebServiceId | string, or null | |
projectId | string | |
repoFullName | string | |
sourceServiceId | string | |
status | ACTIVE, CLOSED, CREATING, FAILED, UPDATING | |
title | string, or null | |
updatedAt | string (date-time) | |
url | string, or null |