Unable to export Kibana dashboard

Hi All. I am using ELK7.6.2 stack.

When I try to export a dashboard I get a 404 error. Please see below

$ curl -k -u user:password -X GET "http://`hostname`:5601/api/kibana/dashboards/export?dashboard=93454870-94dc-11ec-bd98-01e00d252921" -H 'kbn-xsrf: true'

The response is as follows:

{"statusCode":404,"error":"Not Found","message":"Not Found"} 

I am referring to Export dashboard API | Kibana Guide [8.0] | Elastic

Note that user has "superuser" level access.

Please guide.

Any help on this would be appreciated. thanks

Have you verified that the dashboard actually exists?

Hello. Thanks and yes. I copied the dashboard ID from the URL in browser.

Please let me know if this is not the right place to pick the dashboardID
(93454870-94dc-11ec-bd98-01e00d252921)from.

Thanks

This is the right place to get the ID! If you go to Kibana > Saved Objects, do you see the dashboard in there?

Thanks. Yes it does show in the Saved objects

What worked for me was omitting http from the curl request and adding the Kibana's server hash before the /api part of the URL. So something like:
curl -X GET --user username:password "localhost:5601/ogp/api/kibana/dashboards/export?dashboard=<dashboard_id>"

Sorry how can I get the Kibana server hash?

That's just for localhost. If you're not running on localhost, you don't need that. Just try omitting http from the curl request.

Still the same :frowning:

$ curl -X GET --user <user>:<password> "`hostname`:5601/api/kibana/dashboards/export?dashboard=79bd1830-9421-11ec-b354-fba005626143"


{"statusCode":404,"error":"Not Found","message":"Not Found"}

And when you try executing the request from the browser, does it work then?

Browser also gives:

{"statusCode":404,"error":"Not Found","message":"Not Found"}

I'm running out of ideas here, but I would still double-checked your URL. You can also access the 7.6 version documentation here: Export dashboard API | Kibana Guide [7.6] | Elastic

One more thing: Are you running Kibana with or without security? If you're running with, then what roles does the user have? Is it possible the user is either unauthenticated, or under privileged? In order for the export to work from the browser, you need to be logged in to Kibana, as a user with privileges.

Also: Do you have access to Kibana logs? If you could paste a detailed error around the export failure, that would be great.

Thanks for your time. Yes I am using security and the user is "superuser". Kibana logs only show following:

{"type":"response","@timestamp":"2022-03-10T15:35:07Z","tags":[],"pid":8418,"method":"get","statusCode":404,"req":{"url":"/api/kibana/dashboards/export?dashboard=79bd1830-9421-11ec-b354-fba005626143","method":"get","headers":{"user-agent":"curl/7.29.0","host":"xxx.xxx.xxx.xx:5601","accept":"*/*"},"remoteAddress":"16.18.13.13","userAgent":"16.18.13.13"},"res":{"statusCode":404,"responseTime":111,"contentLength":9},"message":"GET /api/kibana/dashboards/export?dashboard=79bd1830-9421-11ec-b354-fba005626143 404 111ms - 9.0B"}

Could it be because we are using basic license?

I don't think it's due to license, this should work for basic license, but I will double check.

Double-checked, the API isn’t license restricted. in 7.6 it’s in the apache OSS build.
We might have a new lead, though. ? The Dashboard API doesn't support search across spaces, so if you are searching for a dashboard in a non-default space it may not work. Is your dashboard in a non-default space? Can you try exporting some dashboard from a default space?

Hello and thanks for following up.

The dashboard I am trying to export is in "Default" space. See below

image

Are you using server.basePath setting in kibana.yml?