Issues Generating a REST Web Services Signature

Anyone have any insight into creating the signature for a REST API SuiteQL signature?  I have one for authenticating and calling a RESTlet script, and it works just fine in my app, but when I try to call the REST API for a SuiteQL query, I keep getting signature errors.

Guessing I must be missing something obvious.  Changing the URLs to the SuiteQL ones keeps returning me error: “error=”token_rejected”, error_description=”Invalid login attempt.””…  But my TBA credentials work perfectly fine with a RESTlet URL instead…

I’m generating my signature using Crypto JS.

Rookie Asked on December 9, 2020 in SuiteTalk.
Add Comment
4 Answer(s)

My personal recommendation would be to use OAuth 1.0a. Otherwise expect to share your code and hope someone can see the issue.

Advanced Answered on December 10, 2020.

Do you have any documentation on generating the signature for the REST Web Service API?  I am using OAuth 1.0.  But, I can’t use Node.

on December 10, 2020.

Not sure what environment you are using, but OAuth 1.0a is universal enough to run in both browsers and node.

on December 10, 2020.

Yeah, I’m not running in a browser or Node.  The issue is not running OAuth, though.  I’m trying to figure out why the signature works fine when calling a RESTlet URL, but does not work when I try to call the REST web services suiteQL URL.

I can’t find anything in the docs about generating the signature for REST Web services, though… :/

on December 10, 2020.

Same signature generation for both. I’ve used bascially the same code for both RESTlet and the Suitetalk REST using OAuth 1.0a in node. You probably need to share your code for more help

on December 10, 2020.

Yeah, I’m using the same signature code.   The only difference I see is the URL.  I’ve tried adding the query string (same as for RESTlets) and not adding it, tot he signature generation.  Both ways I get the same Invalid Signature error.

 

on December 10, 2020.
Add Comment

Hi Charles,

While I don’t think I can provide an answer in Node I can provide an answer in Python as I too had a similar issue. Here’s a link to a sample code set I found in StackOverflow for Python referencing how to access the RESTlet API using Python. I tried using this sample code for REST Web Services and it did not work. Here are the pieces I had to update in order to successfully access REST Web Services API:

URL:  “suitetalk.api.netsuite.com/services/rest” I’m sure you are using this but I figured it worth mentioning the slight differences in the URL just in case.

Nonce/Timestamp/Headers: I had to use Python library “oauthlib” in order to sign the request. This enabled me to mimic what was happening in Postman since all the official Netsuite docs reference using Postman but don’t mention anything about signing requests outside of Postman.

 

Once I implemented oauthlib I was able to successfully sign requests in a way that Netsuite REST Web Services wanted. I know this is rather generic but I hope this at least helps you down the right path.

Rookie Answered on December 10, 2020.
Add Comment

hi,

you can try this library for making requests using nodejs,

https://github.com/ehmad11/netsuite-rest

Rookie Answered on January 29, 2021.
Add Comment

Seeing similar oddities here now in Aug 2023.

Everything is fixed here in our outgoing requests, except obviously TIMESTAMP and OTP (changes every 30 secs).  All else remains untouched.  Yet, pressing F5/reload bunches of times (and watching audit logs inside NS UI) causes ~50% successful login, 50% failed login.  This erratic flip-flop behavior persists not matter the client, no matter the source network, no matter the time-of-day, etc.

google DNS returns 2 different IP addresses for our XXX.restlets.api.netsuite.com (and also for our XXX.suitetalk.api.netsuite.com) lookups — curiously, the two FQDNs share one IP and each also has its own separate/different IP address.  I thought this might indicate a caching / akamai issue, but DNS spoofing everything locally to the one final/single IP (tried the shared IP and also each pointing to its own unique IP) did not cause the 100% go or else 100% no-go that was expected but instead kept right on returning ~50% go/no-go.  This seems to indicate an unobvious cause invisible to us lowlings  Right now NS feels a lot like dealing with Microsoft, where everything was right per the documentational-majority, but yet the things were still constantly gaslighting, causing a resort to reboot-until-it-works-then-do-not-reboot-it-!!! approach / comic routine to “problem solving”.

Quite maddening.  I realize this is only a small, visible part of what’s possibly going on behind their green curtains — akamai and/or NS may be doing all kinds of internal shenanigans.  For instance, I routinely see in the login audit log (for restlets, rest ws, etc) private (10.x.y.z) IP addresses sprinkled amongst the public IPs, indicating scripts/bundles/apps/etc living on different servers hidden behind a special ‘sometimes-NAT”.

I’m wondering if this may all be part of some kind of accidental or maybe even intentional sabotage…the ‘paying partners’ may get a single fixed-server (the better to bill them space/transfer for) instead of the (apparent/presumed?) hodge-podge loose in our not-a-paying-partner/freelance/”consultants”wild.

I find it incredible that a multi-billion-dollar company has the most dreadful system, and far more dreadful “documentation”.

I’ve been programming for several decades, and this NetSuite monster is among the Very Worst.

Dealing with NetSuite has hurt my image and reputation to clients.

Rookie Answered on August 10, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   SuiteMigration   Become a Sponsor