Take a snapshot and keep it
Take a snapshot of a site before a change, wait until it is ready and keep it from expiring.
On this page
A snapshot copies one environment's files and database. This recipe takes one of the site harbourandfinch.example.com and keeps it.
Before you start
- A token with the
readandwritescopes. - Every step needs two-factor enrolment when your company requires it.
- No step waits for a maintenance window.
Take the snapshot
noteis optional and holds up to 140 characters.curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/snapshots \ -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"note": "Before the theme change"}'The answer is
201with the snapshot. Note itsid; itsstatusispendingorcreating.Wait until it is ready
A snapshot is read on its own endpoint, not on the operations endpoint. Read it every few seconds until
statusisreadyorfailed.curl https://manage.corefinity.com/api/corestack/snapshots/3301 \ -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"Keep it
A kept snapshot stays until you stop keeping it. The answer is
200with the snapshot as it is now.curl -X PATCH https://manage.corefinity.com/api/corestack/snapshots/3301 \ -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"protected": true}'Check the list
The site's list shows the snapshot with
protected: true, andsettings.manual_remaining_this_hourshows how many more you can take this hour.curl https://manage.corefinity.com/api/corestack/sites/1042/snapshots \ -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
If it is refused
| Status | reason | What to do |
|---|---|---|
409 | in_flight | A snapshot is already being taken. Wait for it |
409 | restoring | A restore is running. Wait for it to finish |
429 | manual_cap | 20 one-off snapshots were taken of this site in the last hour. Try again later |
429 | google_cap | The hourly limit of all snapshots of the site was reached. Try again later |
422 | disabled | Snapshots are not enabled where the site runs |
422 | state | The snapshot cannot be kept yet: it is not ready, or its size is not known. Do step 2 first |
422 | keep_cap_reached | Kept snapshots already use your whole keep allowance. Stop keeping another snapshot first |
To stop keeping a snapshot, send {"protected": false}. Deleting one needs the destructive scope.