HI Jochen,
Created a test dashboard with one widget.
Get a list of dashboards id’s via API
Get content of single test dash board via API using id
Delete dashboard
Try to restore using API , it fails showing it is missing some required fields.
The json output from the API is
{
"creator_user_id": "admin",
"description": "Dashboard to test resotre via api",
"created_at": "2018-01-10T14:11:25.568Z",
"positions": {
"138e4814-8557-4402-89d0-c6b09cf97f94": {
"width": 1,
"col": 1,
"row": 1,
"height": 3
}
},
"id": "5a561f0d0061f404694f9aa5",
"title": "Test",
"widgets": [
{
"creator_user_id": "admin",
"cache_time": 10,
"description": "Sysmon Events 24h",
"id": "138e4814-8557-4402-89d0-c6b09cf97f94",
"type": "QUICKVALUES",
"config": {
"timerange": {
"type": "relative",
"range": 86400
},
"field": "sysmon_event_id",
"stream_id": "5a5392430061f42d271a703d",
"query": "",
"show_data_table": true,
"limit": 5,
"show_pie_chart": false,
"sort_order": "desc",
"stacked_fields": "",
"data_table_limit": 50
}
}
]
}
Next I tried looking at other content packs to see structure and modified the json to
{
"id" : null,
"name" : "Test Content Pack",
"description" : "Dashboards - Single Test",
"category" : "Test",
"inputs" : [ ],
"streams" : [ ],
"outputs" : [ ],
"dashboards" : [ {
"title" : "Test Restore",
"creator_user_id": "admin",
"description": "Dashboard to test resotre via api",
"created_at": "2018-01-10T14:11:25.568Z",
"positions": {
"138e4814-8557-4402-89d0-c6b09cf97f94": {
"width": 1,
"col": 1,
"row": 1,
"height": 3
}
},
"id": "5a561f0d0061f404694f9aa5",
"widgets": [
{
"creator_user_id": "admin",
"cache_time": 10,
"description": "Sysmon Events 24h",
"id": "138e4814-8557-4402-89d0-c6b09cf97f94",
"type": "QUICKVALUES",
"config": {
"timerange": {
"type": "relative",
"range": 86400
},
"field": "sysmon_event_id",
"stream_id": "5a5392430061f42d271a703d",
"query": "",
"show_data_table": true,
"limit": 5,
"show_pie_chart": false,
"sort_order": "desc",
"stacked_fields": "",
"data_table_limit": 50
}
}
]
}
]
}
The above json is valid according to JSON lint
but graylog looks to expect a title at line 49
{
"type": "ApiError",
"message": "Can not construct instance of org.graylog2.rest.models.dashboards.requests.CreateDashboardRequest, problem: Null title\n at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@64bc727e; line: 49, column: 1]"
}