# Generate reports from a script in CSV is not working

**URL:** https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876
**Category:** Kibana
**Created:** [September 21, 2022, 2:13pm UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876 "2022-09-21T14:13:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![thirty2](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@thirty2](https://discuss.elastic.co/u/thirty2)
#### Post date: [September 21, 2022, 2:13pm UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/1 "2022-09-21T14:13:45Z")

</div>

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](https://www.elastic.co/guide/en/kibana/7.10/automating-report-generation.html)  
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=](http://0.0.0.0:5601/api/reporting/generate/csv?jobParams=)...  
> '

Am i missing something or what is the problem?

Thanks

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [September 22, 2022, 12:59pm UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/2 "2022-09-22T12:59:07Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![thirty2](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@thirty2](https://discuss.elastic.co/u/thirty2)
#### Post date: [September 23, 2022, 7:43am UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/3 "2022-09-23T07:43:59Z")

</div>

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

```auto
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](https://www.elastic.co/guide/en/kibana/7.10/automating-report-generation.html) and there is the report generation URL after `-d` flag too.

---

<div class="post-metadata">

### Author: ![thirty2](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@thirty2](https://discuss.elastic.co/u/thirty2)
#### Post date: [September 27, 2022, 8:14am UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/4 "2022-09-27T08:14:32Z")

</div>

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=...'`

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [September 27, 2022, 5:33pm UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/5 "2022-09-27T17:33:38Z")

</div>

Thanks for reporting, this is definitely a bug. I've [created a pull request](https://github.com/elastic/kibana/pull/141971) to fix the docs.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 25, 2022, 5:34pm UTC](https://discuss.elastic.co/t/generate-reports-from-a-script-in-csv-is-not-working/314876/6 "2022-10-25T17:34:03Z")

</div>

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