# Unable to create watch for reporting : Cannot parse attachment of type \[reporting\]

**URL:** <https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637>\
**Category:** Elasticsearch\
**Created:** [December 11, 2016, 7:58am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637 "2016-12-11T07:58:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [December 11, 2016, 7:58am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/1 "2016-12-11T07:58:33Z")

</div>

I am creating a watch to send dashboard report using mail action , but while running the PUT request I am getting an error as "Cannot parse attachment of type [reporting]"

Here is my simple watch which I am trying to post.

```
PUT _xpack/watcher/watch/test
{
  "trigger": {
    "schedule": {
      "interval": "1h"
    }
  },
  "input": {
    "simple": {
      "name": "Prashant"
    }
  },
  "actions": {
    "reminder_email": {
      "email": {
        "to": "test@gmail.com",
        "from": "test@gmail.com",
        "subject": "Alert : Test",
        "body": "Dear {{ctx.payload.name}}, Email Reporting sample test",
        "attachments": {
          "dashboard.pdf": {
            "reporting": {
              "url": "localhost:5601/api/reporting/generate/dashboard/IP-dashboard"
            }
          }
        }
      }
    }
  }
}

```

Any help on this would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 11, 2016, 8:45pm UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/2 "2016-12-11T20:45:31Z")

</div>

Hey,

which Elasticsearch version are you using? Is it 5.1.1?

--Alex

---

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [December 12, 2016, 2:31am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/3 "2016-12-12T02:31:01Z")

</div>

Hi @spinscale:  
I am using version 5.0.0

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 12, 2016, 7:39am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/4 "2016-12-12T07:39:54Z")

</div>

Hey,

reporting is only supported from version 5.1 on.

--Alex

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 12, 2016, 7:47am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/5 "2016-12-12T07:47:10Z")

</div>

I meant, the `reporting` attachment type in watcher, to be specific. Sorry for the confusion.

---

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [December 12, 2016, 9:50am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/6 "2016-12-12T09:50:23Z")

</div>

Thanks @spinscale : I will check the same with 5.1 version..

Just one more Q's , I used an older approach as :

```
PUT _watcher/watch/test
{
  "trigger" : {
    "schedule": {
      "interval": "1h"
    }
  },
  "actions" : {
  "email_admin" : { 
    "email": {
      "to": "'prashanttct07@gmail.com'",
      "subject": "Error Monitoring Report",
      "attachments" : {
        "error_report.pdf" : {
          "http" : {
            "content_type" : "application/pdf",
            "request" : {
              "method": "POST", 
              "headers": {
                "kbn-xsrf": "reporting"
              },
              "read_timeout": "300s", 
              "auth":{ 
                "basic":{
                  "username":"elastic",
                  "password":"changeme"
                }
              },
              "url": "http://0.0.0.0:5601/api/reporting/generate/dashboard/Dash01?_g=(time:(from:now-1d%2Fd,mode:quick,to:now))&sync" 
            }
          }
        }
      }
    }
  }
 }
}

```

So here also I am getting a failure with below error message.

```
"status": "failure",
          "reason": "Watch[test] attachment[error_report.pdf] HTTP error status host[52.31.61.200], port[5601], method[POST], path[/api/reporting/generate/dashboard/Dash01], status[401]"
        }  

```

So if possible can you let me know how I can get it working in 5.0.0, if I am not planning to upgrade for now.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 12, 2016, 12:15pm UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/7 "2016-12-12T12:15:47Z")

</div>

Hey,

401 means an authorization error. Can you check if the credentials are correct and also ensure this works with curl on the command line?

--Alex

---

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [December 12, 2016, 1:33pm UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/8 "2016-12-12T13:33:47Z")

</div>

Yes, creds are correct as I logged in to Kibana with same credentials ...

Just to confirm here I have to give the same credentials which i used to login to kibana?

Also, do you see if any issue with the query ? As I rechecked and credentials are correct

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [December 13, 2016, 8:04am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/9 "2016-12-13T08:04:24Z")

</div>

Hey,

you should remove the `sync` parameter if you use the `reporting` action as well. Again, can you please make sure this works via curl with the same credentials? If the user is able to create a dashboard in the UI, then this call should work as well.

--Alex

---

<div class="post-metadata">

**Author:** ![Prashant\_Agrawal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_agrawal/32/74982_2.png) [@Prashant\_Agrawal](https://discuss.elastic.co/u/Prashant_Agrawal)\
**Post date:** [December 13, 2016, 9:22am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/10 "2016-12-13T09:22:03Z")

</div>

So far I have not upgraded it to 5.1 and its running with 5.0.

So just curious if I can get it work with 5.0 it does not matters if it is reporting action or HTTP

---

<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:** [January 10, 2017, 9:22am UTC](https://discuss.elastic.co/t/unable-to-create-watch-for-reporting-cannot-parse-attachment-of-type-reporting/68637/11 "2017-01-10T09:22:05Z")

</div>

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