Does anyone know if secure strings (https.SecureSt...
# suitescript
n
Does anyone know if secure strings (https.SecureString) can be used as the body of an https POST request? I have a JSON string containing a password field that I need to send to an external system and I can't seem to get secure strings to work as the request body.
b
Basically not that i can find
you can use the guid as a string template in the body if the body is a string
n
The JSON that I have been trying to use looks like: {"password":"{GUID}"}. I then JSON.stringify the JSON object and use https.createSecureString to make the JSON string a secure string. This process seems to work fine for URLs and headers.
I'm not sure if it's the JSON or the fact that the secure string is in the request body that is the problem.
b
template string, not secure string
Copy code
var guid = "f33875aa66404e5b998c6cdfa6c22b21";
var response = <http://https.post|https.post>({
  url: "<https://httpbin.org/post>",
  credentials: [guid],
  body: JSON.stringify({ password: "{" + guid + "}" })
});
n
I'll give that a try, thanks
That seems to have worked, thanks!