Dashboard Versions

    • limit - Maximum number of results to return
    • start - Version to start from when returning queries

    Gets all existing dashboard versions for the dashboard with the given dashboardId.

    Example request for getting all dashboard versions:

    Example Response

    1. HTTP/1.1 200 OK
    2. Content-Type: application/json; charset=UTF-8
    3. Content-Length: 428
    4. [
    5. {
    6. "id": 2,
    7. "dashboardId": 1,
    8. "parentVersion": 1,
    9. "restoredFrom": 0,
    10. "version": 2,
    11. "created": "2017-06-08T17:24:33-04:00",
    12. "createdBy": "admin",
    13. "message": "Updated panel title"
    14. },
    15. {
    16. "id": 1,
    17. "dashboardId": 1,
    18. "parentVersion": 0,
    19. "restoredFrom": 0,
    20. "version": 1,
    21. "created": "2017-06-08T17:23:33-04:00",
    22. "message": "Initial save"
    23. }
    24. ]

    Status Codes:

    • 200 - Ok
    • 401 - Unauthorized
    • 404 - Dashboard version not found

    GET /api/dashboards/id/:dashboardId/versions/:id

    Get the dashboard version with the given id, for the dashboard with the given id.

    Example request for getting a dashboard version:

    1. GET /api/dashboards/id/1/versions/1 HTTP/1.1
    2. Accept: application/json
    3. Content-Type: application/json
    4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

    Status Codes:

    • 200 - Ok
    • 401 - Unauthorized
    • 404 - Dashboard version not found

    POST /api/dashboards/id/:dashboardId/restore

    Restores a dashboard to a given dashboard version.

    Example request for restoring a dashboard version:

    1. POST /api/dashboards/id/1/restore
    2. Accept: application/json
    3. Content-Type: application/json
    4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
    5. {
    6. "version": 1
    7. }

    JSON body schema:

    • version - The dashboard version to restore toExample response:
    1. HTTP/1.1 200 OK
    2. Content-Type: application/json; charset=UTF-8
    3. Content-Length: 67
    4. {
    5. "slug": "my-dashboard",
    6. "version": 3
    7. }

    JSON response body schema:

    • slug - the URL friendly slug of the dashboard’s title
    • status - whether the restoration was successful or not
    • version - the new dashboard version, following the restorationStatus codes:

    • 401 - Unauthorized
    • 404 - Not found (dashboard not found or dashboard version not found)

    JSON response body schema:

    • message - Message explaining the reason for the request failure.

    POST /api/dashboards/calculate-diff

    Compares two dashboard versions by calculating the JSON diff of them.

    Example request:

    1. POST /api/dashboards/calculate-diff HTTP/1.1
    2. Accept: text/html
    3. Content-Type: application/json
    4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
    5. {
    6. "base": {
    7. "dashboardId": 1,
    8. "version": 1
    9. },
    10. "new": {
    11. "dashboardId": 1,
    12. "version": 2
    13. },
    14. "diffType": "json"
    15. }

    JSON body schema:

    • base - an object representing the base dashboard version
    • new - an object representing the new dashboard version
    • diffType - the type of diff to return. Can be “json” or “basic”.Example response (JSON diff):
    1. HTTP/1.1 200 OK
    2. Content-Type: text/html; charset=UTF-8
    3. <p id="l1" class="diff-line diff-json-same">
    4. </p>

    The response is a textual representation of the diff, with the dashboard values being in JSON, similar to the diffs seen on sites like GitHub or GitLab.

    Status Codes:

    • 200 - Ok
    • 400 - Bad request (invalid JSON sent)
    • 401 - Unauthorized
    • 404 - Not foundExample response (basic diff):

    Status Codes:

    • 200 - OK
    • 400 - Bad request (invalid JSON sent)
    • 401 - Unauthorized