Performs a REST HTTP DELETE call and returns the HTTP response code. Returns a RestResponse representing the response.
A DELETE is used to delete a resource if it exists. The response code returned is 200 if successfully deleted or 404 if the resource does not exist.
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 = "{'force':true}";
var response = services.rest.delete("http://example.com/rest/users", headers, params, auth, opts);
if(response.isSuccess())
{
//display success message
}
else
{
//display failure message
}
Example:
Further documentation.