# POST Url encoding: how do I encode portions of the URL?

**URL:** https://discuss.elastic.co/t/post-url-encoding-how-do-i-encode-portions-of-the-url/264658
**Category:** Kibana
**Created:** [February 18, 2021, 8:01am UTC](https://discuss.elastic.co/t/post-url-encoding-how-do-i-encode-portions-of-the-url/264658 "2021-02-18T08:01:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![eeijlar](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eeijlar](https://discuss.elastic.co/u/eeijlar)
#### Post date: [February 18, 2021, 8:01am UTC](https://discuss.elastic.co/t/post-url-encoding-how-do-i-encode-portions-of-the-url/264658/1 "2021-02-18T08:01:34Z")

</div>

With reference to the following documentation:

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

In it, you can copy a POST Url. I would like to add this url to a file, and then tokenise parts of it so that it can be re-used across multiple runs of a Jenkins pipeline.

Here is what I have at the moment:

```auto
    https://@@hostName@@:@@port@@/kibana/api/reporting/generate/printablePdf?jobParams=%28browserTimezone%3AEurope%2FDublin%2Clayout%3A%28dimensions%3A%28height%3A1120%2Cwidth%3A1914%29%2Cid%3Apreserve_layout%29%2CobjectType%3Adashboard%2CrelativeUrls%3A%21%28%27%2Fapp%2Fkibana%23%2Fdashboard%2Fi@@dashboardName@@%3F_g%3D%28filters%3A%21%21%28%29%2CrefreshInterval%3A%28pause%3A%21%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29%26_a%3D%28description%3A%21%27Overview%2520of%2520system%2520metrics%21%27%2Cfilters%3A%21%21%28%29%2CfullScreenMode%3A%21%21f%2Coptions%3A%28darkTheme%3A%21%21f%29%2Cquery%3A%28language%3Akuery%2Cquery%3A%21%27%21%27%29%2CtimeRestore%3A%21%21f%2C

```

I have put @@ tokens around the hostName, port and dashboardName. I can then substitute those at runtime. I am having some trouble with the 'description' field, as there seems to be some (Rison?) formatting used:

`description%3A%21%27Overview%2520of%2520system%2520metrics%21%27%`

Is there any way to encode this?

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [February 18, 2021, 5:07pm UTC](https://discuss.elastic.co/t/post-url-encoding-how-do-i-encode-portions-of-the-url/264658/2 "2021-02-18T17:07:55Z")

</div>

The `jobParams` query parameter is first rison-encoded, then URI encoded. I'm not sure you've got the dashboard name portion correct... Do you mind pasting the full URL here so I can help?

I think in general what you'll need to do is something like this:

```auto
description%3A%21%27@@description@@%21%27

```

And in order for the description to be encoded properly, you'll have to first rison-encode it and then URI encode it (via `encodeURIComponent`). In practice, you should be able to just use `encodeURIComponent` twice:

```auto
encodeURIComponent(encodeURIComponent('Overview of system metrics'))
// results in "Overview%2520of%2520system%2520metrics"

```

---

<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: [March 18, 2021, 5:07pm UTC](https://discuss.elastic.co/t/post-url-encoding-how-do-i-encode-portions-of-the-url/264658/3 "2021-03-18T17:07:57Z")

</div>

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