Rest Information
Handling Non-JSON Responses in Symphony REST Calls
- By default, Symphony REST calls return data in JSON format.
- However, if you are retrieving binary data such as PDF, JPEG, or other file formats, you need to explicitly set the responseType to "arraybuffer".
- Depending on the need, the responseType can take the following values: 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'
- As shown in the example below, when making a request using sym.rest methods within a symphony app, setting responseType: "arraybuffer" will ensure that the response is returned correctly as binary data.
serviceResponse = (await sym.rest.get(
{
symConfigKey : "getServiceCallFromUrl",
urlData : recordMap,
responseType:"arraybuffer"
}
)).body;