Creating a snapshot using api


#1

hello everyone, i’m trying to create a snapshot using the snapshot api, but it doesn’t work, i hve the following error :


and here is my code :
curl -X POST -H “Content-Type: application/json” -d ‘{
“dashboard”: {
{
"__inputs": [
{
“name”: “DS_MONITORING_RASP”,
“label”: “monitoring_rasp”,
“description”: “”,
“type”: “datasource”,
“pluginId”: “elasticsearch”,
“pluginName”: “Elasticsearch”
}
],
"__requires": [
{
“type”: “datasource”,
“id”: “elasticsearch”,
“name”: “Elasticsearch”,
“version”: “3.0.0”
},
{
“type”: “grafana”,
“id”: “grafana”,
“name”: “Grafana”,
“version”: “4.4.3”
},
{
“type”: “panel”,
“id”: “graph”,
“name”: “Graph”,
“version”: “”
}
],
“annotations”: {
“list”: []
},
“editable”: true,
“gnetId”: null,
“graphTooltip”: 0,
“hideControls”: false,
“id”: null,
“links”: [],
“rows”: [
{
“collapse”: false,
“height”: “250px”,
“panels”: [
{
“aliasColors”: {},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: “${DS_MONITORING_RASP}”,
“fill”: 1,
“id”: 1,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “connected”,
“percentage”: false,
“pointradius”: 5,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: [],
“spaceLength”: 10,
“span”: 12,
“stack”: false,
“steppedLine”: false,
“targets”: [
{
“bucketAggs”: [
{
“fake”: true,
“field”: “mac”,
“id”: “3”,
“settings”: {
“min_doc_count”: 1,
“order”: “desc”,
“orderBy”: “_term”,
“size”: “10”
},
“type”: “terms”
},
{
“field”: “date”,
“id”: “2”,
“settings”: {
“interval”: “auto”,
“min_doc_count”: 0,
“trimEdges”: 0
},
“type”: “date_histogram”
}
],
“dsType”: “elasticsearch”,
“metrics”: [
{
“field”: “temperature”,
“id”: “1”,
“meta”: {},
“settings”: {},
“type”: “max”
}
],
“query”: “mac: $mac”,
“refId”: “A”,
“timeField”: “date”
}
],
“thresholds”: [],
“timeFrom”: null,
“timeShift”: null,
“title”: “Panel Title”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”: []
},
“yaxes”: [
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
]
}
],
“repeat”: null,
“repeatIteration”: null,
“repeatRowId”: null,
“showTitle”: false,
“title”: “Dashboard Row”,
“titleSize”: “h6”
},
{
“collapse”: false,
“height”: 250,
“panels”: [
{
“aliasColors”: {},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: “${DS_MONITORING_RASP}”,
“fill”: 1,
“id”: 2,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“links”: [],
“nullPointMode”: “connected”,
“percentage”: false,
“pointradius”: 5,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: [],
“spaceLength”: 10,
“span”: 12,
“stack”: false,
“steppedLine”: false,
“targets”: [
{
“bucketAggs”: [
{
“fake”: true,
“field”: “mac”,
“id”: “3”,
“settings”: {
“min_doc_count”: 1,
“order”: “desc”,
“orderBy”: “_term”,
“size”: “10”
},
“type”: “terms”
},
{
“field”: “date”,
“id”: “2”,
“settings”: {
“interval”: “auto”,
“min_doc_count”: 0,
“trimEdges”: 0
},
“type”: “date_histogram”
}
],
“dsType”: “elasticsearch”,
“metrics”: [
{
“field”: “ramutil”,
“id”: “1”,
“meta”: {},
“settings”: {},
“type”: “max”
}
],
“query”: “mac: $mac”,
“refId”: “A”,
“timeField”: “date”
}
],
“thresholds”: [],
“timeFrom”: null,
“timeShift”: null,
“title”: “Panel Title”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”: []
},
“yaxes”: [
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
]
}
],
“repeat”: null,
“repeatIteration”: null,
“repeatRowId”: null,
“showTitle”: false,
“title”: “Dashboard Row”,
“titleSize”: “h6”
}
],
“schemaVersion”: 14,
“style”: “dark”,
“tags”: [],
“templating”: {
“list”: [
{
“allValue”: null,
“current”: {},
“datasource”: “${DS_MONITORING_RASP}”,
“hide”: 0,
“includeAll”: false,
“label”: null,
“multi”: false,
“name”: “mac”,
“options”: [],
“query”: “{“find”: “terms”, “field”: “mac”}”,
“refresh”: 2,
“regex”: “”,
“sort”: 0,
“tagValuesQuery”: “”,
“tags”: [],
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
}
]
},
“time”: {
“from”: “now-6h”,
“to”: “now”
},
“timepicker”: {
“refresh_intervals”: [
“5s”,
“10s”,
“30s”,
“1m”,
“5m”,
“15m”,
“30m”,
“1h”,
“2h”,
“1d”
],
“time_options”: [
“5m”,
“15m”,
“1h”,
“6h”,
“12h”,
“24h”,
“2d”,
“7d”,
“30d”
]
},
“timezone”: “”,
“title”: “monitoring”,
“version”: 5
}
},
“expires”: 3600
}’ http://admin:admin@localhost:3000/api/snapshots

i don’t know what i do wrong, if you can help me, i would really appreciate!!
thanks!


#2

looks like invalid json


#3

thanks for your reply!
i know but i don’t know where, i haven’t made the json, i just export my dashboard
the syntax looks correct for the rest?