Skip to Content

Data Retrieval

Roll back a dashboard release

Put a dashboard back the way an earlier release left it.

POST
/api/v2/data-app/dashboard-releases/rollback

A roll back is a new release that restores an old one. Every call is a dry run unless you send "dryRun": false.

Before you start

Steps

  1. Run a dry run:

    curl --request POST https://api.usedatabrain.com/api/v2/data-app/dashboard-releases/rollback \  --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \  --header "Content-Type: application/json" \  --data '{ "workspaceName": "Production", "dashboardId": "sales-overview", "release": "r-8k2m" }'
  2. Read data.checks and data.canRollBack. Copy data.expectedVersion.

  3. Send the same body with "dryRun": false and "expectedVersion": "<data.expectedVersion>".

You get the new release id in data.releaseId. If you send the same roll back again, for example after a timeout, you get the release it already made, with "replayed": true.

Authorization

ServiceToken
headerAuthorizationBearer <token>

A service token. A data app API token is refused.

Body

workspaceNamestringrequired

The workspace of the dashboard that the release changed. For a promote from Staging to Production, this is Production.

dashboardIdstringrequired

The dashboard's externalDashboardId

releasestringrequired

The release id or shortId to restore.

dryRunboolean

Only false rolls back. Default: a dry run.

Default: true

Required to roll back. The expectedVersion of your dry run.

The metricId of each shared metric you agree to change. The dry run's SHARED_METRIC checks list them.

Default: []

An https URL that gets a signed POST afterwards, as on promote

Response

Dry run:

{  "data": {    "releaseShortId": "r-8k2m",    "summary": { "added": 0, "updated": 2, "retired": 1, "unchanged": 5 },    "metrics": [{ "name": "Churn", "action": "retired" }],    "checks": [],    "canRollBack": true,    "noChanges": false,    "expectedVersion": "4b1d..."  }}

Roll back:

{ "data": { "releaseId": "5e6f7a8b-...", "shortId": "r-9p3q", "restored": "r-8k2m", "summary": { "added": 0, "updated": 2, "retired": 1, "unchanged": 5 } } }

With callbackUrl, the response also has callback: { "delivered": true, "status": 200 }.

Errors

Statuserror.codeWhy
400WORKSPACE_NOT_FOUNDNo workspace, or more than one, has this name
400EXPECTED_VERSION_REQUIREDYou rolled back without expectedVersion
400INVALID_CALLBACK_URLcallbackUrl is not a public https URL
403AUTHENTICATION_ERRORInvalid Service Token: you used a data app API token
403FEATURE_NOT_ENABLEDDashboard environments are not on for your company
404RELEASE_NOT_FOUNDRelease not found. No release of this dashboard has this id or shortId
404DASHBOARD_NOT_FOUNDNo dashboard in the workspace has this id
409LIVE_CHANGEDThe dashboard changed after your dry run
409NO_CHANGESThe dashboard already matches that release.
409PUBLISH_IN_PROGRESS or RETRYSomeone changed this dashboard a moment ago, or Databrain was busy. Run the dry run again
422CHECKS_FAILEDThis roll back is blocked. The body has checks
500INTERNAL_SERVER_ERRORNothing was changed. Try again.

For errors that every endpoint returns, see Authentication.

Example Request
curl -X POST 'https://api.usedatabrain.com/api/v2/data-app/dashboard-releases/rollback' \  -H 'Content-Type: application/json' \  -d '{  "workspaceName": "string",  "dashboardId": "string",  "release": "string"}'
Example Response
{  "data": {    "releaseId": "5e6f7a8b-...",    "shortId": "r-9p3q",    "restored": "r-8k2m",    "summary": {      "added": 0,      "updated": 2,      "retired": 1,      "unchanged": 5    },    "callback": {      "delivered": true,      "status": 200    }  }}