Sites and deploy
Publish a site
What this is-
Prepare
index.htmland use relative links for the other files. Keep servers and build tools out of the upload; upload their static output. -
Publish it.
“Publish these files as my bakery site.” Confirm the name and address before the first publish.SendPOST /v1/sites/{sitename}/fileswith{"files":{"index.html":"..."}}, or send an archive toPOST /v1/sites/{sitename}withContent-Type: application/zip. Send your key inX-API-Key. -
Open the returned address and test the links and form saves.
Update files
What this is-
Read the current file list before replacing files.
-
Send the change.
“On my bakery site, change the opening time to 8 am. Keep the other pages.”SendPUT /v1/sites/{sitename}/files?keep=1with the changedfiles. To replace the whole file tree, omitkeep=1and send every file. -
Open the live address and check the changed page.
Preview and publish a version
What this is- Save the update with
publish=false. ReadGET /v1/sites/{sitename}/versionsand note its version number. - Create a preview with
POST /v1/sites/{sitename}/versions/2/preview-link. Open the returned link; it stops working after an hour. - Publish it with
PUT /v1/sites/{sitename}/active-versionand{"version_number":2}. To roll back, read the version list and send the earlier number instead.
Rename or take a site offline
What this is- Choose the site and check its current name with
GET /v1/sites. - Send
PATCH /v1/sites/{sitename}with{"name":"new-name"}to rename it, or{"offline":true}to take it offline. - To reopen it, send
{"offline":false}to the current name.
Delete or restore a site
What this is- Download a copy with
GET /v1/sites/{sitename}/export.tar.gzif you need it. - Confirm the site name, then send
DELETE /v1/sites/{sitename}. - To undo, list
GET /v1/me/deleted-sitesand sendPOST /v1/sites/{sitename}/restorebefore the returned deadline. A deleted site is restorable for 7 days.
Errors you may see
| Code | Means | Do this |
|---|---|---|
site_exists (409) |
Name already used | Update that site or choose another name |
not_found (404) |
Update files: no matching site | Read the site list |
site_not_found (404) |
Rename or roll back: no matching site | Read the site list |
| HTTP 404 (no code) | Delete: no matching site | Read the site list |
item_too_large (413) |
Upload exceeds a cap | Check Limits and errors |