Retrieve the Domain for Calling a RESTlet
The following sample shows how to retrieve the domain for calling a RESTlet.
Note:
This sample script uses the require
function so that you can copy it into the SuiteScript Debugger and test it. You must use the define
function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.x Script Basics and SuiteScript 2.x Script Types.
Important:
The value used in this sample for the accountId
field is a placeholder. Before using this sample, replace the accountId
field value with a valid value from your NetSuite account. If you run a script with an invalid value, an error may occur.
/**
* @NApiVersion 2.x
*/
// This script retrieves the domain for calling a RESTlet.
require(['N/url'], function(url) {
function resolveDomainUrl() {
var sCompId = 'MSTRWLF';
var output = url.resolveDomain({
hostType: url.HostType.RESTLET,
accountId: sCompId
});
}
resolveDomainUrl();
});