Performs a REST HTTP HEAD call on a resource. Returns a RestResponse representing the response.
A HEAD is the same as a GET, apart from it does not have a body. This is only used to determine whether a resource is available.
Example:
//set any headers
var headers = {};
//set params
var params = {"userId":fields.filter.value};
//create authentication
var auth = HttpAuthentication.createBasicAuthentication("username", "password");
var opts = new RestOptions();
//setting the wait time to establish a connection to the target server to 5 seconds
opts.setConnectionTimeout(5);
//set the time to wait for no inactivity from the rest call to 10 seconds
opts.setSocketTimeout(10);
var body = "{'showall': true}';
var response = services.rest.head("http://example.com/rest/users", headers, params, auth, opts, body);
if(response.isSuccess())
{
//display available message
}
else
{
//display failure message
}
Example:
Further documentation.