Set an application's publish state

View as Markdown

Sets the application's publish state.

Full description

Sets the application's publish state. &#123; "published": true &#125; takes the site live at urls.publish; &#123; "published": false &#125; takes it back behind its Coming Soon page. Returns 202 Accepted with an AppOperation that carries no app; the Location header and links[rel=self] give the poll URL. Poll GET /app-operations/&#123;operationId&#125; until status is COMPLETED or FAILED, then read GET /apps/&#123;appId&#125;/publish-state. A request for the state the application is already in is accepted with 202 and runs no change; the returned AppOperation is already COMPLETED. The body is a PublishState carrying only published: exactly &#123; "published": <boolean> &#125;. A body that lacks published, whose published is not a boolean, or that has any other field, the read-only firstPublishedAt, updatedAt and links included, is a 400. Going live is subject to the subscription's plan: a plan that allows no live sites, or one whose live-site limit is reached, answers 422 with details[].issue PUBLISH_LIMIT_EXCEEDED. The limit is checked again as the change runs, so a concurrent publish that takes the last slot ends the operation FAILED with error.details[].issue PUBLISH_LIMIT_EXCEEDED; any other failure ends it FAILED with PUBLISH_STATE_CHANGE_FAILED. A subscription that is not active cannot take a site live and answers 403 with details[].issue SUBSCRIPTION_INACTIVE. Taking a site offline is never limited. An application whose status is DELETING answers 422 with details[].issue APP_DELETING, whichever state is requested. While another write holds the application's lock, the request answers 503 with details[].issue UPSTREAM_UNAVAILABLE and Retry-After: 5; retry after that delay. The request is idempotent by nature, so Idempotency-Key is not used. While a change for this application is still running, a PUT for the same state returns 202 with that running operation; a PUT for the opposite state is refused with 409 and details[].issue PUBLISH_STATE_CHANGE_IN_PROGRESS. Poll the running operation, then retry. The same 409 is returned for a moment while another publish-state request on the same subscription is being accepted; retry shortly. Offered for the same products as GET /apps/&#123;appId&#125;/publish-state; NODEJS- ids answer 501 NOT_APPLICABLE.

PUT
/apps/{appId}/publish-state

Authorization

bearerAuth
AuthorizationBearer <token>

Personal Access Token (PAT). Generate one from the developer dashboard. Pass as: Authorization: Bearer <token>.

In: header

Path Parameters

appId*string

Application identifier in {PRODUCT}-{id} form. The prefix is the application type in upper case — an upper-case letter followed by any number of upper-case letters, digits, or underscores — then a hyphen, then the identifier. For NODEJS, the suffix is a 10-character nanoid. Example: NODEJS-aBcDeFgHiJ. For MHWP, the suffix is a 10-character nanoid of lower-case letters and digits only. Example: MHWP-a1b2c3d4e5.

Match^[A-Z][A-Z0-9_]*-[A-Za-z0-9_-]+$

Header Parameters

traceparent?string

W3C Trace Context identifier for this request. Clients should send a traceparent on every request so the trace can be correlated across services. See https://www.w3.org/TR/trace-context/ for the format.

Match^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$

Request Body

application/json

Whether an application is live. The go-live resource for products that have no build or deploy step, such as Managed Hosting for WordPress (MHWP): a WordPress site is provisioned ready to serve and is taken live, or back behind its Coming Soon page, by changing this state. GET returns the current state. PUT with { "published": true } or { "published": false } starts the change and returns 202 Accepted; poll the operation in Location and links[rel=self] until it is COMPLETED or FAILED. A PUT that asks for the state the application is already in is accepted with 202 and runs no change; the returned AppOperation is already COMPLETED.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/apps/string/publish-state" \  -H "Content-Type: application/json" \  -d '{    "published": true  }'
{  "operationId": "string",  "type": "CREATE_APP",  "status": "PENDING",  "app": {    "id": "NODEJS-aBcDeFgHiJ",    "status": "CREATING",    "region": "na",    "createdAt": "stringstringstringst",    "links": [      {        "href": "http://example.com",        "rel": "string",        "title": "string",        "targetMediaType": "string",        "targetSchema": null,        "method": "string",        "submissionMediaType": "application/json",        "submissionSchema": null      }    ]  },  "error": {    "name": "string",    "correlationId": "string",    "message": "string",    "informationLink": "string",    "details": [      {        "field": "string",        "value": "string",        "location": "body",        "issue": "string",        "description": "string"      }    ],    "links": [      {        "href": "http://example.com",        "rel": "string",        "title": "string",        "targetMediaType": "string",        "targetSchema": null,        "method": "string",        "submissionMediaType": "application/json",        "submissionSchema": null      }    ]  },  "createdAt": "stringstringstringst",  "links": [    {      "href": "http://example.com",      "rel": "string",      "title": "string",      "targetMediaType": "string",      "targetSchema": null,      "method": "string",      "submissionMediaType": "application/json",      "submissionSchema": null    }  ]}

Agent & Automation Notes

Scopeshosting.deployment:execute
Rate limit10 req/min and 100 req/hour per customer. A 429 can have an empty body and RateLimit-* headers; wait Retry-After if present, otherwise RateLimit-Reset.
IdempotentYes
DestructiveNo
On failureReturns 202 with a SET_PUBLISH_STATE operation; poll GET /app-operations/{operationId} until COMPLETED or FAILED. Idempotent by nature: a PUT for the current state returns an already COMPLETED operation, and a PUT for the state already in progress returns the running operation. 409 PUBLISH_STATE_CHANGE_IN_PROGRESS: poll the running change, or retry shortly if the subscription is busy. 503 with Retry-After: wait and retry.

Last updated on

How is this guide?