Performs a REST HTTP OPTIONS call and returns the HTTP response code. Returns a RestResponse representing the response.
Example:
var uri = "http://example.com/rest/users";
//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 response = services.rest.options(uri, auth, opts);
if(response.isSuccess())
{
var allowed = response.getHeaders()['Allow'];
if(allowed)
{
var results = allowed.split(',');
var list = fields.options.createCustomList();
for each(var x in results)
{
list.add(x);
}
}
}
Example:
Further documentation.