Large Response Payloads
If you're building a polling integration that has response payloads larger than 5MB then you'll need to save them as attachments and adapt your response processing.
Example Use Case
Request Script
// Process the request e.g. by executing a web service and returning the response
(function (poll_request, poller, connection, params) {
var request, response;
request = new sn_ws.RESTMessageV2();
request.setHttpMethod('GET');
request.setEndpoint(poll_request.endpoint_url);
request.setRequestHeader('Content-Type','application/json');
request.setBasicAuth(connection.getBasicAuthUser(), connection.getBasicAuthPassword());
// Save the response as a new attachment (on the poll request)
request.saveResponseBodyAsAttachment(
poll_request.getTableName(), poll_request.sys_id, params.attachment.file_name
);
response = request.execute();
poll_request.response_code = response.getStatusCode();
poll_request.response_status = response.getErrorMessage();
if (response.haveError()) {
throw '\nResponse Code: ' + response.getErrorCode() + '\nResponse error: ' + response.getErrorMessage();
}
// Return the sys_id of the saved attachment
answer = response.getResponseAttachmentSysid() + '';
})(poll_request, poller, connection, params);Response Script
Last updated
Was this helpful?
