Foundation Data & Integrations
Outbound HTTP Requests (Scripted)
6 min
servicely provides a comprehensive api for performing outbound http communications from the scripting environment there are four classes that make up the support for outbound http requests http, getrequest, httprequestwithbody and httpresponse requests are initiated by the http class http method description return a get request for a specific url return a head request for a specific url return a post request for a specific url return a put request for a specific url return a patch request for a specific url return an options request for a specific url return a delete request for a specific url getrequest getrequest method description set basic auth credentials set the socket timeout of the connection set the connect timeout of the connection set a request header get the request url set a placeholder in the url with a value e g http get("http //httpbin org/{method}") routeparam("method", "get") querystring("name", "mark") execute(); to use this functionality, you need to be on version 1 10 or later this allows you to disable the validation of ssl certificates (common for self signed certificates) this will only work if you also have a boolean application property set to true called system http client disable ssl validation allowed http disablesslvalidation() get('https //example com') execute() getbody() set a query string parameter execute the request execute the request to get http response in bytes set an outbound auth token httprequestwithbody all the methods of getrequest along with the following method description set the content type header for the request set the accept header for the request set the body of the request set the body of the request as json set the body of the request as a byte array set a field parameter and its value this allows you to send an attachment via “binary”/multipart form data to systems and can be used to send multiple attachments in one request httpresponse method description if the status not is not 2xx success code return the body return the body return the body as json return the body as json return the status code return the status code return the status text return the status text httpresponsebinary method description toattachment() tablerecord storing a httpresponsebinary into attachment table e g