New Data Centers for Netsuite Accounts


As of September, 2012 Netsuite has started hosting different accounts to different data centers. That means if you are developing SuitTalk Apps for multiple accounts then you have to make sure that you are using correct URL for these.

These two articles can help you make necessary changes in your code

https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteFlex/SuiteScript/SSScriptTypes_UsingtheRESTrolesServicetoReturnUserAccountRoleandDomain.html

https://system.netsuite.com/help/helpcenter/en_US/Output/Help/SuiteFlex/WebServices/STP_getDataCenterUrls.html

Although Netsuite PHP Toolkit 2012_2 has built-in methods to get the URLs but if you are not using that then below is the Sample PHP class that can be used to access Netsuite Rest Roles Service

class AccountsGrabber {

private $curl;

public function __construct($email, $password) {
 $this->curl = curl_init();
 curl_setopt($this->curl, CURLOPT_HTTPHEADER, array(
 'Authorization: NLAuth nlauth_email=' . $email . ', nlauth_signature=' . $password
 ));
 }

public function __destruct() {
 curl_close($this->curl);
 }

public function getAccounts() {
 $url = 'https://system.netsuite.com/rest/roles';
 curl_setopt($this->curl, CURLOPT_URL, $url);
 curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, TRUE);
 $result = curl_exec($this->curl);

return json_decode($result);
 }
 }
Advertisements

I am a web developer working @ Gaditek

Tagged with:
Posted in Netsuite, Programming & Development
7 comments on “New Data Centers for Netsuite Accounts
  1. Tarang Lute says:

    Very Usefull…Can u please tell me how to do this in .net

    In Netsuite,we have scenario where
    1. User will login via desktop application.
    2. On successfull login we need to redirect user to netsuite webapplication.
    3. We want to continue user desktop session in netsuite web application also.

    **Note : Login will only be done via desktop application.**
    Currenlty we are using Netsuite webservice with passport authentication.Also is it possible to login netsuite without providing account number.

  2. Tarang Lute says:

    Very Usefull…Can u please tell me how to do this in .net

    In Netsuite,we have scenario where
    1. User will login via desktop application.
    2. On successfull login we need to redirect user to netsuite webapplication.
    3. We want to continue user desktop session in netsuite web application also.

    **Note : Login will only be done via desktop application.**
    Currenlty we are using Netsuite webservice with passport authentication.Also is it possible to login netsuite without providing account number.

  3. dreamxtream says:

    @Tarang Lute

    Using the call described in the post you CAN login without providing account number as All account numbers against a username and password are returned in this call.

    For Web login, Have you tried Single Signon Feature?

  4. Tarang Lute says:

    Actually after login we need to redirect user to contact page or search page. We cant use single on feature in out application.Do Netsuite have oauth implementation?

  5. dreamxtream says:

    @Tarang Lute

    I don’t think that Netsuite supports OAuth

  6. Tarang Lute says:

    In Netsuite documentation, i found that for passport login via web service, session is managed by cookie jseesionid.So after successfull login if i redirect user to netsuite search page or any internal page ,so in this way can i bypass the netsuite web login for the current user.

  7. dreamxtream says:

    @Tarang Lute

    NS Browser session works on Cookies, You need to somehow put the cookies in the browser session. Not sure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

About me
A geek trying to make world a better place to live.

I mostly work on Web Technologies like PHP, Javascript. I also work on Python, GAE and Netsuite Customization. Currently working @ Cloudways

Profile Links Linkedin | Github | Stackoverflow
Subscribe to this blog
%d bloggers like this: