I have almost figured it out now. Rather than using the "requestContentType" parameter, I use the parameter "Content-Type" inside the header instead:
def parameterMap = [ uri: "$URI", headers: ["Auth-Token": "${settings.APIToken}", "Content-Type": "application/x-www-form-urlencoded"], query: ["EM_USOC": "$backupBuffer"]]
That now produces a "200" response but not with the response I expected.
What I have realised now is that my request from HE is also missing the "Content-Length" parameter (see Postman snapshot in the first post). I have figured out how to calculate the value for the length (trial and error using Postman), but not how to add it to the parameter map in HE. If I add it to the headers:
def parameterMap = [ uri: "$URI", headers: ["Auth-Token": "${settings.APIToken}", "Content-Type": "application/x-www-form-urlencoded", "Content-Length": "$contentLength" ], query: ["EM_USOC": "$backupBuffer"]]
I get the error "408 - Unknown Exception"
I cannot find a documented parameter to use for Content-Length, but trying the following:
def parameterMap = [ uri: "$URI", headers: ["Auth-Token": "${settings.APIToken}", "Content-Type": "application/x-www-form-urlencoded"], query: ["EM_USOC": "$backupBuffer"], "Content-Length": "$contentLength"]
def parameterMap = [ uri: "$URI", headers: ["Auth-Token": "${settings.APIToken}", "Content-Type": "application/x-www-form-urlencoded"], query: ["EM_USOC": "$backupBuffer"], contentLength: "$contentLength"]
def parameterMap = [ uri: "$URI", headers: ["Auth-Token": "${settings.APIToken}", "Content-Type": "application/x-www-form-urlencoded"], query: ["EM_USOC": "$backupBuffer"], length: "$contentLength"]
all gave me an "408 - Unexpected keyword args" error
Anyone know how to add Content-Length to the request?