Export kibana viisualization using api

Hello

Is there any way to make an api/ curl request to Kibana, and get a graph image (any type of visualization)?

Hey @liorg2,

Wouldn't Reporting API work for your use case?

Best,
Oleg

Yes thanks. seems to be working.

which role/ space permissiond should I give to a user I created for that purpose please?
It works for me with "elastic" user but not with users I'm creating. Download returns 404

You need to assign a special role to a user, you can read all the details here: https://www.elastic.co/guide/en/kibana/current/secure-reporting.html

I've added this role,
image

But when I do:

Visualization > PNG report > copy post url > run curl (with the created user)

I get a valid response:
...{"path":"/api/reporting/jobs/download/kfpljsvl000w82f160ah1dzk","job":{"id":"kfpljsvl000w82f160ah1dzk","index":".reporting-2020-09-27","_seq_no":38,"....

but this page stays empty:

AND when I run the download curl, I get 404

when doing the same with the elastic user, everything is working

when running

GET .reporting-2020-09-27/_doc/kfpljsvl000w82f160ah1dzk

I see a warning in the document:

"status" : "completed_with_warnings",

From the docs I pasted above:

Users will also need the appropriate Kibana privileges to access the objects to report on and the Elasticsearch indices.

If you log in with that custom user - do you see all the data you want to generate report for?