Snapshot API

Create new snapshot

POST /api/snapshots

Example Request:

  1. POST /api/snapshots HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
  5. {
  6. "dashboard": {
  7. "editable":false,
  8. "hideControls":true,
  9. "nav":[
  10. {
  11. "enable":false,
  12. "type":"timepicker"
  13. }
  14. ],
  15. "rows": [
  16. {
  17. }
  18. ],
  19. "style":"dark",
  20. "tags":[],
  21. "templating":{
  22. "list":[
  23. ]
  24. },
  25. "time":{
  26. },
  27. "timezone":"browser",
  28. "title":"Home",
  29. "version":5
  30. },
  31. "expires": 3600
  32. }

JSON Body schema:

  • dashboard – Required. The complete dashboard model.
  • name – Optional. snapshot name
  • expires - Optional. When the snapshot should expire in seconds. 3600 is 1 hour, 86400 is 1 day. Default is never to expire.
  • external - Optional. Save the snapshot on an external server rather than locally. Default is false.
  • key - Optional. Define the unique key. Required if external is true.
  • deleteKey - Optional. Unique key used to delete the snapshot. It is different from the key so that only the creator can delete the snapshot. Required if external is true.Example Response:
  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {
  4. "deleteKey":"XXXXXXX",
  5. "deleteUrl":"myurl/api/snapshots-delete/XXXXXXX",
  6. "key":"YYYYYYY",
  7. "url":"myurl/dashboard/snapshot/YYYYYYY"
  8. }

Keys:

  • deleteKey – Key generated to delete the snapshot
  • key – Key generated to share the dashboard

Get list of Snapshots

GET /api/dashboard/snapshots

Query parameters:

  • query – Search Query
  • limit – Limit the number of returned resultsExample Request:
  1. GET /api/dashboard/snapshots HTTP/1.1
  2. Accept: application/json
  3. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. [
  4. {
  5. "id":8,
  6. "name":"Home",
  7. "key":"YYYYYYY",
  8. "orgId":1,
  9. "userId":1,
  10. "external":false,
  11. "externalUrl":"",
  12. "expires":"2200-13-32T25:23:23+02:00",
  13. "created":"2200-13-32T28:24:23+02:00",
  14. "updated":"2200-13-32T28:24:23+02:00"
  15. }
  16. ]

Get Snapshot by Key

GET /api/snapshots/:key

Example Request:

  1. GET /api/snapshots/YYYYYYY HTTP/1.1
  2. Accept: application/json
  3. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {
  4. "meta":{
  5. "isSnapshot":true,
  6. "type":"snapshot",
  7. "canSave":false,
  8. "canEdit":false,
  9. "canStar":false,
  10. "slug":"",
  11. "expires":"2200-13-32T25:23:23+02:00",
  12. "created":"2200-13-32T28:24:23+02:00"
  13. },
  14. "dashboard": {
  15. "editable":false,
  16. "hideControls":true,
  17. "nav": [
  18. {
  19. "enable":false,
  20. "type":"timepicker"
  21. }
  22. ],
  23. "rows": [
  24. {
  25. }
  26. ],
  27. "style":"dark",
  28. "tags":[],
  29. "templating":{
  30. "list":[
  31. ]
  32. },
  33. "time":{
  34. },
  35. "timezone":"browser",
  36. "title":"Home",
  37. "version":5
  38. }
  39. }

Delete Snapshot by Key

DELETE /api/snapshots/:key

Example Request:

  1. DELETE /api/snapshots/YYYYYYY HTTP/1.1
  2. Accept: application/json
  3. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Snapshot deleted. It might take an hour before it's cleared from any CDN caches."}

Delete Snapshot by deleteKey

This API call can be used without authentication by using the secret delete key for the snapshot.

GET /api/snapshots-delete/:deleteKey

Example Request:

  1. GET /api/snapshots-delete/XXXXXXX HTTP/1.1
  2. Accept: application/json

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Snapshot deleted. It might take an hour before it's cleared from any CDN caches."}