Makes an HTTP request to the integrator.io API.
Applies to
My APIs > integrator.io API runtime object
Argument
options <Object>
The options argument contains the following properties:
method <String>
– the HTTP method to use; defaults to GET if unspecifiedrelativeURI <String, required>
– the URI relative to api.integrator.io; for ex. v1/connectionsqs <Object>
– a plain object representing the querystring key-value pairs to be appended to relativeURIheaders <Object>
– a plain object representing the key-value pairs to be appended to the HTTP headersbody <Object>
– the HTTP request body
Returns
<Object>
The response object contains the following properties:
statusCode <Number>
– the HTTP status codeheaders <Object>
– the headers object contains all HTTP response headers, which can be accessed as follows:headers.headerName
– accessor to get a specific header value; headerName is case-insensitiveheaders()
– function to return all headers
body <Object>
– the HTTP response body
Exceptions
This function throws an error only if the HTTP request could not be completed, such as when the options argument was invalid or there was a timeout (the remote server took too long to respond or the response takes too long to transmit).
Note that 5xx and 4xx HTTP response code errors do not result in an error from this function; the code is passed through in the response object.
Example
let resp = request({
method: 'GET',
relativeURI: 'v1/connections',
qs: {
'admin': 'true'
},
headers: {
'X-Requested-With': 'XMLHttpRequest'
},
body: { }
})
Comments
0 comments
Please sign in to leave a comment.