REST call with String parameter with control characters
I am trying to design a RESTful service that takes a string (with control characters). Does something with that in the logic on the server, then returns a string, which may also have control characters.
Basically the string is a pharmacy claim in a delimited format that uses control characters for those delimiters. The logic on the server will pull the entire claim apart and process it.
I was thinking that a GET method could be uses but I'm used to sending content in JSON format and wondered what other normal RESTful ways there were to do this.
A common and simple approach is to Base64-encode binary data. See $System.Encryption.Base64Encode()/$System.Encryption.Base64Decode(), plus the atob and btoa functions in JavaScript (maybe not relevant in your particular case, depending on what the client is).
So if I am calling this service from an Ensemble operation that looks something like this:
Would I just call
$system.
Encryption.Base64Encode()
on the claimBlob property?URL and URI Conversions
Try:
Set tURL=..Adapter.URL_"/claims/"_##class(%CSP.Page).EscapeURL(pRequest.claimBlob)
or
Set tURL=..Adapter.URL_"/claims/"_$zcvt($zcvt(pRequest.claimBlob,"O","UTF8"),"O","URL")
See $zcvt for JSON, e.g.: