Generate reports from a script in CSV is not working

Hi,
i am trying to use a script to generate reports in CSV and i am following the steps as written in the documentation here
When i try to run a curl command i am getting error like this:

{"error":"Incorrect HTTP method for uri [/] and method [POST], allowed: [DELETE, GET, HEAD]","status":405}

Curl commnad is:

curl -XPOST "hostname:9200" -H 'Content-Type: application/json' -d'
http://0.0.0.0:5601/api/reporting/generate/csv?jobParams=...
'

Am i missing something or what is the problem?

Thanks

Hi @thirty2. I think your Curl command is malformed. You are passing the report generation URL after the -d flag. The URL should be passed where you have hostname:9200.

So the official documentation is wrong too?
This is Copy as curl

curl -X POST "localhost:9200/\?pretty" -H 'Content-Type: application/json' -d'
-u elastic \ 
-H \u0027kbn-xsrf: true\u0027 \ 
\u0027http://0.0.0.0:5601/api/reporting/generate/csv?jobParams=...\u0027
'

from here and there is the report generation URL after -d flag too.

It is working with curl like this:

curl -XPOST -u yourUser-H 'kbn-xsrf: true ' 'http://0.0.0.0:5601/api/reporting/generate/csv?jobParams=...'

1 Like

Thanks for reporting, this is definitely a bug. I've created a pull request to fix the docs.