Automatically download dashboard csv file by api fail

Hello, we are developing a project for company, and we are working with the ELK stack.

I have a problem that I have some visualizations in Dashboard and I want to download csv file by shell script (Automatically generate reports | Kibana Guide [7.14] | Elastic), but I am not sure how to put value injobParams or where do I learn to get the value of jobParams .

I try to google find some example,but that will return "404 Not Found" or "400 Bad Request".

Here are the command that I tried to download:

> curl -X POST \
> -u 'elastic:password' \
> -H 'kbn-xsrf: true' \
> 'https://myKibanaHostname/api/reporting/generate/csv?jobParams=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))'
{"statusCode":404,"error":"Not Found","message":"Not Found"}
 curl -X POST \
> -u 'elastic:password' \
> -H 'kbn-xsrf: true' \
> 'https://myKibanaHostname/api/reporting/generate/csv?jobParams=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-1h,to:now))&_a=(description:'',filters:!(),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!t),query:(language:kuery,query:''),tags:!(),timeRestore:!f,title:'Top%20N%20%20Copy',viewMode:edit)'
{"statusCode":400,"error":"Bad Request","message":"[request query]: types that failed validation:\n- [request query.0._a]: definition for this key is missing\n- [request query.1]: expected value to equal [null]"}

We are very urgent to be able to solve this problem because it is of strategic significance.

Thank you very much for your help.

Hi @luckygoodlily,

you can get jobParams by going to Discover > share > csv reports > advanced options > copy post url and you'll get and URL with correct jobParams for your automated report.

Same for Dashboard, but for png/pdf reports

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.