Dasard Versions
Get all dasard versions by dasard UID
Query parameters:
- limit - Maximum number of results to return
- start - Version to start from when returning queries
GET /api/dasards/uid/:uid/versions
Gets all existing dasard versions for the dasard with the given uid
.
Example request for getting all dasard versions:
GET /api/dasards/uid/QA7wKklGz/versions?limit=2?start=0 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 428
{
"continueToken": "",
"versions": [
{
"id": 2,
"dasardId": 1,
"uid": "QA7wKklGz",
"parentVersion": 1,
"restoredFrom": 0,
"version": 2,
"created": "2017-06-08T17:24:33-04:00",
"createdBy": "admin",
"message": "Updated panel title"
},
{
"id": 1,
"dasardId": 1,
"uid": "QA7wKklGz",
"parentVersion": 0,
"restoredFrom": 0,
"version": 1,
"created": "2017-06-08T17:23:33-04:00",
"createdBy": "admin",
"message": "Initial save"
}
]
}
Status Codes:
- 200 - Ok
- 400 - Errors
- 401 - Unauthorized
- 404 - Dasard version not found
Get dasard version by dasard UID
GET /api/dasards/uid/:uid/versions/:version
Get the dasard version with the given version, for the dasard with the given UID.
Example request for getting a dasard version:
GET /api/dasards/uid/QA7wKklGz/versions/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Example response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 1300
{
"id": 1,
"dasardId": 1,
"uid": "QA7wKklGz",
"parentVersion": 0,
"restoredFrom": 0,
"version": 1,
"created": "2017-04-26T17:18:38-04:00",
"message": "Initial save",
"data": {
"annotations": {
"list": [
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"links": [
],
"rows": [
{
"collapse": false,
"height": "250px",
"panels": [
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": false,
"title": "Dasard Row",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"tags": [
],
"templating": {
"list": [
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "test",
"version": 1
},
"createdBy": "admin"
}
Status Codes:
- 200 - Ok
- 401 - Unauthorized
- 404 - Dasard version not found
Restore dasard by dasard UID
POST /api/dasards/uid/:uid/restore
Restores a dasard to a given dasard version using uid
.
Example request for restoring a dasard version:
POST /api/dasards/uid/QA7wKklGz/restore
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"version": 1
}
JSON body schema:
- version - The dasard version to restore to
Example response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 67
{
"id": 70,
"slug": "my-dasard",
"status": "success",
"uid": "QA7wKklGz",
"url": "/d/QA7wKklGz/my-dasard",
"version": 3
}
JSON response body schema:
- slug - the URL friendly slug of the dasard’s title
- status - whether the restoration was successful or not
- version - the new dasard version, following the restoration
Status codes:
- 200 - OK
- 400 - Bad request (specified version has the same content as the current dasard)
- 401 - Unauthorized
- 404 - Not found (dasard not found or dasard version not found)
- 500 - Internal server error (indicates issue retrieving dasard tags from database)
Example error response
HTTP/1.1 404 Not Found
Content-Type: application/json; charset=UTF-8
Content-Length: 46
{
"message": "Dasard version not found"
}
JSON response body schema:
- message - Message explaining the reason for the request failure.
Compare dasard versions
POST /api/dasards/calculate-diff
Compares two dasard versions by calculating the JSON diff of them.
Example request:
POST /api/dasards/calculate-diff HTTP/1.1
Accept: text/html
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"base": {
"dasardId": 1,
"version": 1
},
"new": {
"dasardId": 1,
"version": 2
},
"diffType": "json"
}
JSON body schema:
- base - an object representing the base dasard version
- new - an object representing the new dasard version
- diffType - the type of diff to return. Can be “json” or “basic”.
Example response (JSON diff):
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
<p id="l1" class="diff-line diff-json-same">
<!-- Diff omitted -->
</p>
The response is a textual representation of the diff, with the dasard values being in JSON, similar to the diffs seen on sites like or GitLab.
Status Codes:
- 200 - Ok
- 400 - Bad request (invalid JSON sent)
- 401 - Unauthorized
- 404 - Not found
Example response (basic diff):
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
<div class="diff-group">
<!-- Diff omitted -->
</div>
The response here is a summary of the changes, derived from the diff between the two JSON objects.
Status Codes:
- 200 - OK
- 400 - Bad request (invalid JSON sent)
- 401 - Unauthorized
- 404 - Not found