Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetSuite SuiteTalk REST Web Services - Invalid Login Attempt

I am trying to use the NetSuite SuiteTalk REST Web Services to access NetSuite CRM data.

I have the access up and working in production. Able to retrieve record data and metadata.

I am now trying to set up access in the sandbox for more in-depth testing.

In the sandbox I have: - Enabled rest web services - Enabled token based authentication - Given user concurrent web services permission - Given user Log in using access tokens permission - Created an integration - Created an access token

All of these actions mirrored what was done in production.

When I attempt any kind of GET to the web service, I receive a 401 - Invalid login attempt.

When I check the Login Audit Trail, I don't see any record of the GET attempt, failed or otherwise.

Is there something of a systemic nature that I have to do additionally in the sandbox to enable rest web services? Above and beyond enabling it in SuiteCloud/SuiteTalk?

The fact that I see absolutely nothing in the audit trail makes me believe that something is still "turned off".

===> 4/4/2020 Update

ed14 and Nihkil,

Thank you for your responses, and sorry for the delay in responding back.

The hyphen to underscore in the realm did not help me unfortunately.

Let me recap recent attempts:

1) Started by verifying that REST API testing in production still works.

2) The sandbox was refreshed by a CRM admin. The application was still there, but my access token was not. I created a new one in the sandbox.

Is it possible to delete the application? I cannot see any way to do that.

3) Tested with existing Consumer Token and new Access Token. Got the same response as from my first post: "title": "Invalid login attempt, for more details see Login Audit Trail.",

4) Tested by slightly modifying the URL to make sure I was not going to a black hole somewhere. It gave me the expected error.

5) Tested by modifying the realm: Realm 9999999-sb4 to Realm 9999999_sb4 It gave me an error which leads me to believe that my original realm is correct: "title": "An unexpected error occurred. Error ID: k8hd8pqej3unxblmaoik",

Again, none of the tests show up in anywhere in the audit log as a failed attempt.

Not sure where to go from here? Delete the sandbox application (if possible) and start again? Or new application in sandbox?

Thanks for any and all help.

Bryan Hunt

like image 914
Bryan Hunt Avatar asked Dec 22 '19 19:12

Bryan Hunt


People also ask

How do I use a REST API with NetSuite?

REST web services provide a REST-based interface for interacting with NetSuite. Use CRUD (create, read, update, delete) operations to perform business processing on NetSuite records and to navigate dynamically between records. For details, see Working with Records. Get and process the API definition and record metadata.

How do I view login attempts in the Netsuite UI?

Invalid login attempt. For more details, see the Login Audit Trail in the NetSuite UI at Setup > Users/Roles > User Management > View Login Audit Trail. Unauthorized. (-1) (SQLExecDirectW)')

How do I familiarize myself with NetSuite web services?

To familiarize yourself with NetSuite web services, we encourage you to download our sample applications, which are available in Java and C#. These are command-line driven applications that illustrate how to use some of the key features of the platform. The C# sample applications require version 4.5 of the Microsoft .NET framework.

How do I start using the Netsuite toolkit?

Start using the toolkit by adding a require_once statement. For example: require_once ' PHPToolkit/NetSuiteService.php'; Configure connection parameters such as server, email, and password by modifying the defaults in the NSconfig.php file.


3 Answers

I had the same issue using the sandbox. Apparently there is a mismatch between the account ID (used in realm authorization) and the account ID in the URL.

The account ID (realm): XXXXX_SB1

The account ID in the url: XXXXX-SB1

The SB should be in upper case.

This solved the problem for me.

like image 185
ed14n Avatar answered Oct 27 '22 21:10

ed14n


As @ed14n and @nikhil-abraham said, changing - to _ in authorization realm and put the SB in UPPER CASE solve this problem here.

If you are using POSTMAN template provided from NetSuite, your envs should be like the image below.

Postman environments

like image 3
palhares Avatar answered Oct 27 '22 21:10

palhares


In Postman in your request tab and then in the authorization tab in the advanced section there is a field called Realm. Put the account id in the realm field with underscores.

like image 1
Nikhil Abraham Avatar answered Oct 27 '22 20:10

Nikhil Abraham