Does anybody know the syntax to escape special html characters in ScriptRunner?
I have user input in the form of "H&S" and the ampersand is killing my REST call so I need to escape it.
I can only find Java examples and it looks like the libraries are not available in ScriptRunner
If I have an "&" in the pageBody the post fails.
// Create a new page
def pageResp = post("/wiki/rest/api/content")
.basicAuth(APIUSERNAME, APIPASSWORD)
.header('Content-Type', 'application/json')
.body([
type: "page",
title: pageTitle,
space: [
key: pageSpace // set the space key
],
// Add page under a parent
ancestors: [
[
type: "page",
id: parentPage, // Parent page
]
],
body: [
storage: [
value: pageBody,
representation: "storage"
]
],
metadata:[
labels: [
[name:"hazard-investigations"],
[name:"uncontrolled"]
]
]
])
.asObject(Map)
Thanks in advance.