# Exporting a Timelion PNG at a certain date

**URL:** <https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701>\
**Category:** Kibana\
**Tags:** timelion\
**Created:** [October 29, 2020, 1:38pm UTC](https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701 "2020-10-29T13:38:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Docrom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/docrom/32/78004_2.png) [@Docrom](https://discuss.elastic.co/u/Docrom)\
**Post date:** [October 29, 2020, 1:38pm UTC](https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701/1 "2020-10-29T13:38:17Z")

</div>

Hello everyone,

I'm a beginner of Elastic/Kibana and I'm really struggling to find a topic talking about what I want on Google so here I am and I hope you can help me.

So, I have a Timelion visualization and I want to export it as a PNG to put it in a Word document via a PHP script. The problem is, I want to be able to put a time range in the PHP code and add it to the Dashboard POST URL and then curl it into an image. The time range would be generated from my website.

Is it possible this way or another ? I can't find something close to it on the forums etc.. Maybe with an API ?

Thank you for your help !

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [October 30, 2020, 7:25am UTC](https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701/2 "2020-10-30T07:25:14Z")

</div>

The POST url you can copy from the dialog on Dashboard or Visualize is the API to fetch a report - the time range is part of that. A small example:

 ![Screenshot 2020-10-30 at 08.18.54](https://us1.discourse-cdn.com/elastic/original/3X/8/1/81ba36dc3e0061391af2c6eddad4154fc179f74f.png)

This is my visualization - notice the "Last 24 hours" in the time picker.

Now I'm copying the POST url:

 ![Screenshot 2020-10-30 at 08.19.43](https://us1.discourse-cdn.com/elastic/original/3X/9/3/938bdecfc05616f89c3ff00c124b9b6ddc92cf54.png)

This gives me:  
`http://my_kibana_host/api/reporting/generate/png?jobParams=%28browserTimezone%3AEurope%2FBerlin%2Clayout%3A%28dimensions%3A%28height%3A381%2Cwidth%3A907%29%2Cid%3Apng%29%2CobjectType%3Avisualization%2CrelativeUrl%3A%27%2Fapp%2Fvisualize%23%2Fedit%2Fde899760-1a7f-11eb-9616-df3bbcea55eb%3Ftype%3Dtimelion%26_g%3D%28filters%3A%21%21%28%29%2Cquery%3A%28language%3Akuery%2Cquery%3A%21%27%21%27%29%2CrefreshInterval%3A%28pause%3A%21%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-24h%2Cto%3Anow%29%29%26_a%3D%28filters%3A%21%21%28%29%2Clinked%3A%21%21f%2Cquery%3A%28language%3Alucene%2Cquery%3A%21%27%21%27%29%2CuiState%3A%28%29%2Cvis%3A%28aggs%3A%21%21%28%29%2Cparams%3A%28expression%3A%21%27.es%28%2A%29%21%27%2Cinterval%3Aauto%29%2Ctitle%3Atest%2Ctype%3Atimelion%29%29%27%2Ctitle%3Atest%29`

it looks really messy, but around halfway through there's this part:  
`time%3A%28from%3Anow-24h%2Cto%3Anow%29%29`

This is the value of the current time picker - it's the html encoded version of `time:(from:now-24h,to:now)` which in turn is the rison encoded version of this JSON snippet: `"time": { "from": "now-24h", "to":"now"}`. You can generate this URL inside your PHP script and switch out `now-24h` and `now` with your desired time range programatically. It also takes absolute dates as an ISO string, play around with the Kibana UI and generate the URL to see how it behaves.

---

<div class="post-metadata">

**Author:** ![Docrom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/docrom/32/78004_2.png) [@Docrom](https://discuss.elastic.co/u/Docrom)\
**Post date:** [October 30, 2020, 9:49am UTC](https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701/3 "2020-10-30T09:49:06Z")

</div>

Hi Joe,

That is exactly what I wanted, thank you for clarification, really appreciated !

Have a good day,  
Docrom

---

<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:** [November 27, 2020, 9:49am UTC](https://discuss.elastic.co/t/exporting-a-timelion-png-at-a-certain-date/253701/4 "2020-11-27T09:49:11Z")

</div>

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