Hi Stephen. Similar issues using the saved objects API. I've tried the following:
curl -k -XPOST -H 'kbn-xsrf: true' -H 'Content-Type: application/json'
http://127.0.0.1:5601/s/test/api/saved_objects/_bulk_create -d @app-server-system-overview.ndjso
which returns {"statusCode":400,"error":"Bad Request","message":"Invalid request payload JSON format"}
and trying x-ndjson (thinking it may explain the error)
{"statusCode":415,"error":"Unsupported Media Type","message":"Unsupported Media Type"}
And then avoiding the bulk API in favour of saved objects/dashboards
curl -k -XPOST -H 'kbn-xsrf: true' -H 'Content-Type: application/json'
http://127.0.0.1:5601/s/test/api/saved_objects/dashboard -d @app-server-system-overview.ndjson
I get {"statusCode":400,"error":"Bad Request","message":"Invalid request payload JSON format"}
There must be something wrong with the ndjson file. Perhaps I need to pre-format it before importing it. But as it comes directly from the Kibana UI export I didn't think this was necessary. Extract of app-server-system-overview.ndjson as follows:
{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{"query":{"query":"","language":"kuery"},"filter":}"},"title":"CPU Usage [Metricbeat System] ECS","uiStateJSON":"{}","version":1,"visState":"{"title":"CPU Usage [Metricbeat System] ECS","type":"metrics","aggs":,"params":{"time_range_mode":"entire_time_range","axis_formatter":"number","axis_position":"left","id":"80a04950-1b19-11e7-b09e-037021c4f8df","index_pattern":"metricbeat-*","interval":"auto","series":[{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"#68BC00","fill":"1","formatter":"percent","id":"80a04951-1b19-11e7-b09e-037021c4f8df","label":"user","line_width":1,"metrics":[{"field":"system.cpu.user.pct","id":"80a04952-1b19-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"},{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"rgba(211,49,21,1)","fill":"1","formatter":"percent","id":"993acf30-1b19-11e7-b09e-037021c4f8df","label":"system","line_width":1,"metrics":[{"field":"system.cpu.system.pct","id":"993acf31-1b19-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"},{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"rgba(123,100,255,1)","fill":"1","formatter":"percent","id":"65ca35e0-1b1a-11e7-b09e-037021c4f8df","label":"nice","line_width":1,"metrics":[{"field":"system.cpu.nice.pct","id":"65ca5cf0-1b1a-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"},{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"rgba(226,115,0,1)","fill":"1","formatter":"percent","id":"741b5f20-1b1a-11e7-b09e-037021c4f8df","label":"irq","line_width":1,"metrics":[{"field":"system.cpu.irq.pct","id":"741b5f21-1b1a-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"},{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"rgba(176,188,0,1)","fill":"1","formatter":"percent","id":"2efc5d40-1b1a-11e7-b09e-037021c4f8df","label":"softirq","line_width":1,"metrics":[{"field":"system.cpu.softirq.pct","id":"2efc5d41-1b1a-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"},{"time_range_mode":"entire_time_range","axis_position":"right","chart_type":"line","color":"rgba(15,20,25,1)","fill":"1","formatter":"percent","id":"ae644a30-1b19-11e7-b09e-037021c4f8df","label":"iowait","line_width":1,"metrics":[{"field":"system.cpu.iowait.pct","id":"ae644a31-1b19-11e7-b09e-037021c4f8df","type":"avg"}],"point_size":"0","seperate_axis":0,"split_color_mode":"gradient","split_mode":"everything","stacked":"stacked"}],"show_grid":1,"show_legend":1,"time_field":"@timestamp","type":"timeseries","use_kibana_indexes":false,"drop_last_bucket":1,"axis_scale":"normal","truncate_legend":1,"max_lines_legend":1,"tooltip_mode":"show_all","isModelInvalid":false,"filter":{"query":"host.name:\"metricbeat-pri\"","language":"kuery"}}}"},"coreMigrationVersion":"8.5.0","id":"79e5b8fd-704b-4e00-a38f-6f35e6914773","migrationVersion":{"visualization":"8.5.0"},"references":,"type":"visualization","updated_at":"2023-02-08T08:24:33.365Z","version":"Wzk1MDEsM10="}
{"attributes"