# Use Script to Autogenerate Reports is not working

**URL:** https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462
**Category:** Elasticsearch
**Tags:** elastic-stack-reporting
**Created:** [September 30, 2020, 7:48am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462 "2020-09-30T07:48:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)
#### Post date: [September 30, 2020, 7:48am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/1 "2020-09-30T07:48:59Z")

</div>

Hi Team,

As per the steps given in the documentation using Curl user should be able to generate reports using custom script.  
I tried the below curl command by following the steps given in the document , it's throwing me errors.  
I have checked the elasticsearch and kibana services status they are up and running without any issues.  
Please help me to resolve this issue.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/3/93c84db7e51948ae148cc87e342d300cd6880c7a.png)

Thanks in Advance,  
Ramya

---

<div class="post-metadata">

### Author: ![kavierkoo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kavierkoo/32/86555_2.png) [@kavierkoo](https://discuss.elastic.co/u/kavierkoo)
#### Post date: [September 30, 2020, 7:55am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/2 "2020-09-30T07:55:58Z")

</div>

try **-XPOST** instead of **-X POST**

See some example here:

> **[Build your own dashboard | Kibana Guide \[7.9\] | Elastic](https://www.elastic.co/guide/en/kibana/current/tutorial-build-dashboard.html#_load_the_data_sets)**

Hope this can help you!

---

<div class="post-metadata">

### Author: ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)
#### Post date: [September 30, 2020, 8:36am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/3 "2020-09-30T08:36:48Z")

</div>

@kavierkoo, Thanks for your reply.

No luck with **-XPOST**  
The examples you are referring, are to load json data to Elasticsearch using POST.  
I'm looking for generating Report as described here

> **[Automating report generation | Kibana Guide \[7.6\] | Elastic](https://www.elastic.co/guide/en/kibana/7.6/automating-report-generation.html)**

Thanks,  
Ramya

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 30, 2020, 8:39am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/4 "2020-09-30T08:39:12Z")

</div>

Please don't post pictures of text, they are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

---

<div class="post-metadata">

### Author: ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)
#### Post date: [September 30, 2020, 8:47am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/5 "2020-09-30T08:47:31Z")

</div>

Hi @warkolm  
My apologies for that !!

Please find the command i executed

```
    curl -k -X POST "https://x.x.x.x:9200/\?pretty" -H 'Content-Type: application/json' -d'
    -u elastic \
    -H \u0027kbn-version: 7.6.2\u0027 \
    \u0027
    https://x.x.x.x:5601/s/cdm-reports/api/reporting/generate/csv?jobParams=it continues
\u0027'

```

Error :

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

```

Thanks,  
Ramya

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 30, 2020, 8:48am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/6 "2020-09-30T08:48:41Z")

</div>

Thanks 🙂  
Remove the `?pretty` and try again.

---

<div class="post-metadata">

### Author: ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)
#### Post date: [September 30, 2020, 10:09am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/7 "2020-09-30T10:09:45Z")

</div>

Hi @warkolm,

It's not working even after removing "?pretty"  
Do you have any idea ,where can find this path :

> /api/reporting/jobs/download/"autogenerated job ID"

```
{
  "path": "/api/reporting/jobs/download/jxzaofkc0ykpf4062305t068", 
  "job": {
    "id": "jxzaofkc0ykpf4062305t068",
    "index": ".reporting-2018.11.11",
    "jobtype": "csv",
    "created_by": "elastic",
    "payload": ..., 
    "timeout": 120000,
    "max_attempts": 3,
    "priority": 10
  }
}

```

Thanks,  
Ramya

---

<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 28, 2020, 10:09am UTC](https://discuss.elastic.co/t/use-script-to-autogenerate-reports-is-not-working/250462/8 "2020-10-28T10:09:45Z")

</div>

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