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

With reference to the following documentation:

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:


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:


Is there any way to encode this?

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:


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:

encodeURIComponent(encodeURIComponent('Overview of system metrics'))
// results in "Overview%2520of%2520system%2520metrics"
1 Like

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