getDataCenterUrls

You use the getDataCenterUrls operation to obtain the correct URL for external client access to NetSuite.

getDataCenterURLs requests do not require authentication, nor any information identifying the application. The getDataCenterUrls operation ignores all authentication data, if any such data is sent.

SOAP web services versions 2019.1 and later are only available on account-specific domains. The URL for your account-specific SOAP web services domain includes your account ID. For example, if your account ID was 123456, then your account-specific SOAP web services domain would be 123456.suitetalk.api.netsuite.com. As of 2019.1, the getDataCenterUrls operation also returns your account-specific SOAP web services domain.

For more details, see Dynamic Discovery of URLs.

Important:

As of the 2019.1 SOAP web services endpoint, you must use account-specific domains with SOAP web services. Use the SOAP getDataCenterUrls operation to obtain the correct domain. Or, go to Setup > Company > Setup Tasks > Company Information in the NetSuite UI. Your domains are listed on the Company URLs subtab.

Important:

If you receive the following error, either use your account-specific domain for your request for the data center URL, or use the c parameter in your request to specify your account ID. Using either your account-specific domain, or using the c parameter in your request, ensures that you receive the correct response. The routing depends on the version of your NetSuite account, and not the version of the WSDL you use.

An example of using the c parameter in a request.

In addition to the URL for SOAP web services access, the getDataCentersUrls operation also supports discovery of other NetSuite domains. You can use this operation to discover any of the following:

Note:

When you send your initial dynamic discovery call, you should use the https://webservices.netsuite.com URL.

If you are building an integration for your own use or for a single customer, you integration must include logic to determine the correct URL for the appropriate NetSuite account. If you are building an application that will be distributed to multiple customers, you must incorporate logic that can determine the correct URL for any of those customers.

REST Services as Alternate Methods for Dynamic Discovery of URL

The getDataCenterUrls operation is available in the 2012.2 and later endpoints. However, you do not have to upgrade your endpoint to support dynamic discovery of the correct SOAP web services domain. NetSuite also provides REST services that you can use.

For general information about the DataCenterUrls REST service, see The DataCenterUrls REST Service.

Request

The GetDataCenterUrlsRequest type is used for this request. It requires the following field:

Element Name

XSD Type

Notes

account

string

NetSuite account ID.

Note:

If an invalid account ID is specified, the default URLs are returned.

Response

The GetDataCenterUrlsResult type is used for the response. It contains the following fields:

Element Name

XSD Type

Notes

status

Status

The status for this operation. All applicable errors or warnings are listed within this type.

restDomain

string

URL used by external client applications to access NetSuite through a RESTlet.

systemDomain

string

 

webservicesDomain

string

URL used by external client applications to access NetSuite through SOAP web services.

Faults

This operation can throw one of the following faults. See SOAP Fault Status Codes for more information on faults.

Also, a DATA_REQD error is thrown if no account ID is provided in the request. For an example, see SOAP Response (empty account).

Sample Code

C# Sample

              class  DataCenterDomains  : NetSuiteService
    {

        private System.Uri OriginalUri;

        public  DataCenterDomains (string account, bool doNotSetUrl)
            : base()
        {
            OriginalUri = new System.Uri(this.Url);
            if (account == null || account.Length == 0)
                account = "empty";
            if (!doNotSetUrl)
            { 
                DataCenterUrls urls = getDataCenterUrls(account).dataCenterUrls;
                Uri dataCenterUri = new Uri(urls.webservicesDomain + OriginalUri.PathAndQuery);
                this.Url = dataCenterUri.ToString();
            }
        }

        public void SetAccount(string account)
        {
            if (account == null || account.Length == 0)
                account = "empty";

            this.Url = OriginalUri.AbsoluteUri;
            DataCenterUrls urls = getDataCenterUrls(account).dataCenterUrls;
            Uri dataCenterUri = new Uri(urls.webservicesDomain + OriginalUri.PathAndQuery);
            this.Url = dataCenterUri.ToString();
        }
    } 

        

Java Sample

          /**
 * Since 12.2 endpoint accounts are located in multiple data centers with different domain names.
 * To use the correct one, wrap the Locator and get the correct domain first.
 *
 * See getDataCenterUrls WSDL method documentation in the Help Center.
 */
private static class  dataCenters  extends NetSuiteServiceLocator
{
   private String account;
 
   public  dataCenters (String account)
   {
      this.account = account;
   }
 
   @Override
   public NetSuitePortType getNetSuitePort(URL defaultWsDomainURL)
   {
      try
      {
         NetSuitePortType _port = super.getNetSuitePort(defaultWsDomainURL);
         // Get the webservices domain for your account
         DataCenterUrls urls = _port.getDataCenterUrls(account).getDataCenterUrls();
         String wsDomain = urls.getWebservicesDomain();
 
         // Return URL appropriate for the specific account
         return super.getNetSuitePort(new URL(wsDomain.concat(defaultWsDomainURL.getPath())));
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
   }
}
 
---
// Locate the NetSuite web service.
NetSuiteServiceLocator service = new  dataCenters ("myAccount");
// Get the service port (to the correct data center)
_port = service.getNetSuitePort(new URL("https://webservices.netsuite.com/services/NetSuitePort_2012_2")); 

        

Java Sample

          public void testDataCenterUrlsPublic() throws Exception
{
    NLWsClient c = new NLWsClient();   
    c.initPort();
    String account = "1326288";
 
 
    System.out.println("Account: " + account);
    DataCenterUrls urls = c.getPort().getDataCenterUrls(account).getDataCenterUrls();
 
 
    System.out.println("\tREST domain: " + urls.getRestDomain());
    System.out.println("\tWeb services domain: " + urls.getWebservicesDomain());
    System.out.println("\tSystem domain: " + urls.getSystemDomain());
    System.out.println();
} 

        

SOAP Request

          <?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body> 
         <getDataCenterUrls xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">  
            <account>1326288</account> 
         </getDataCenterUrls>
      </soapenv:Body>
   </soapenv:Envelope> 

        

SOAP Response

          <?xml version="1.0" encoding="utf-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header>
         <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2017_1.platform.webservices.netsuite.com">
            <platformMsgs:nsId>WEBSERVICES_1326288_08162012790521873260264554_10fa27f165429</platformMsgs:nsId>
         </platformMsgs:documentInfo>
      </soapenv:Header>
      <soapenv:Body>
         <getDataCenterUrlsResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <getDataCenterUrlsReturn xsi:type="GetDataCenterUrlsResult" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
               <platformCore:status isSuccess="true"/>
               <platformCore:dataCenterUrls>
                  <platformCore:restDomain>https://<accountID>.restlets.api.netsuite.com</platformCore:restDomain>
                  <platformCore:webservicesDomain>https://<accountID>.suitetalk.api.netsuite.com</platformCore:webservicesDomain>
                  <platformCore:systemDomain>https://<accountID>.app.netsuite.com</platformCore:systemDomain>
               </platformCore:dataCenterUrls>
            </getDataCenterUrlsReturn>
         </getDataCenterUrlsResponse>
      </soapenv:Body>
   </soapenv:Envelope> 

        

SOAP Response (empty account)

          <?xml version="1.0" encoding="utf-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header>
         <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2017_1.platform.webservices.netsuite.com">
            <platformMsgs:nsId>WEBSERVICES__0911201212589142971204370270_d03cd34b349479541b</platformMsgs:nsId>
         </platformMsgs:documentInfo>
      </soapenv:Header>
      <soapenv:Body>
         <getDataCenterUrlsResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
            <getDataCenterUrlsReturn xsi:type="GetDataCenterUrlsResult" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com">
               <platformCore:status isSuccess="false">
                  <platformCore:statusDetail type="ERROR">
                     <platformCore:code>DATA_REQD</platformCore:code>
                     <platformCore:message>You need to provide a proper value for the required field: account.</platformCore:message>
                  </platformCore:statusDetail>
               </platformCore:status>
            </getDataCenterUrlsReturn>
         </getDataCenterUrlsResponse>
      </soapenv:Body>
   </soapenv:Envelope> 

        

Related Topics

General Notices