# Calling shorten URL api from watcher

**URL:** <https://discuss.elastic.co/t/calling-shorten-url-api-from-watcher/179153>\
**Category:** Kibana\
**Created:** [April 30, 2019, 9:10pm UTC](https://discuss.elastic.co/t/calling-shorten-url-api-from-watcher/179153 "2019-04-30T21:10:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [April 30, 2019, 9:10pm UTC](https://discuss.elastic.co/t/calling-shorten-url-api-from-watcher/179153/1 "2019-04-30T21:10:33Z")

</div>

In the post below, I'm investigating if it's possible for a painless script to call the shortened URL api. I realize that is not possible. Now I'm wondering if the watcher, through a web hook possibly, can call the shortened URL api, receive the response, then pass the result (the short URL) to the payload of another action.

Basically, our watchers send a kibana dashboard link to the payload of one of our action webhooks. I'm trying to see if I can shorten the URL.

Original post:

> [@Shortened url from painless](https://discuss.elastic.co/t/shortened-url-from-painless/171793):
>
> Is there any way to call the shortened url api from a painless script, preferably without making a post/put call? I have a stored script that all our watchers use...and it returns back the link to one of our kibana dashboards. The link is very long and breaks for those who have to copy/paste the link. We're currently in 6.5 kibana.

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [April 30, 2019, 10:32pm UTC](https://discuss.elastic.co/t/calling-shorten-url-api-from-watcher/179153/2 "2019-04-30T22:32:48Z")

</div>

Hi Matt, I think your best bet would be to create a [webhook action](https://www.elastic.co/guide/en/x-pack/current/actions-webhook.html) that hits an API endpoint on your server. Inside of that API handler, you could hit the [shorten URL API](https://www.elastic.co/guide/en/kibana/current/url-shortening-api-api-shorten-url.html) and do whatever else you need to with the watch payload.

The one thing I don't believe you can do is return the response from the webhook to watcher and perform other actions.

---

<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:** [May 28, 2019, 10:32pm UTC](https://discuss.elastic.co/t/calling-shorten-url-api-from-watcher/179153/3 "2019-05-28T22:32:50Z")

</div>

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