The HTTP Module allows you to create HTTP and HTTPS requests as HTTPRequest objects, send them, and use their responses as HTTPResult objects.
The HTTP module exposes methods for creating HTTPRequest objects.
Creates an HTTPRequest from the provided HTTP request method and resource URI.
var request = HTTP.create('GET', 'https://daas.caristix.com/fhir_r4/Patient');
Creates an HTTPRequest from the provided HTTP request method, NetworkConnection object and resource URL path. Request host, client certificate and timeout are obtained from the NetworkConnection.
var connection = NetworkConnections.getConnection('DaaS Caristix FHIR R4 Server');
var requestFromConnection = HTTP.createFromNetworkConnection('GET', connection, '/Patient');
This object exposes properties and methods to edit and send an HTTP request.
The HTTP method used by the request, as defined when creating the request.
var method = request.method;
// The value should be equal to "GET".
The fully-qualified URI of the request, as defined when creating the request.
var uri = request.uri;
//The value should be equal to "https://daas.caristix.com/fhir_r4/Patient"
Sends the request and returns the result.
var result = request.send();
Sets the request’s body to the provided string.
//The request's body should be equal to "MSH|^~\&|"
Sets the request’s timeout in seconds to the provided amount. The default value is 30 seconds.
//The request's timeout should be equal to 5 seconds.
Sets the request’s Client Certificate using the provided serial number.
Adds an HTTP header to the request.
//The request should contain the "Accept" header with value "application/json"
This object exposes properties to read an HTTP response’s body and status code.
The response’s body.
var body = result.body;
The response’s HTTP status code.
var status = result.statusCode;
var succeeded = status == 200;