04-09-2021 10:56 AM
Hi,
I am trying to mimic a REST Post request, done in Postman, to NetSuite. I am struggling to understand how to replicate the authentication method. In Postman, I can use the OAuth 1.0 authentication type and successfully send a request.
How would I setup the SnapLogic REST Post snap to mimic this? I tried to setup the REST OAuth 1.0 account, however, it is not setup the same way as Postman’s OAuth 1.0.
.
Thank you.
04-12-2021 07:02 AM
Quite honestly, I do not know which one my attempt falls under. Essentially, I am trying to send a suiteql query through https://xxxxx.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql with an OAuth 1.0 authentication method. I apologize if this does not answer your questions.
Thanks,
Johnny
07-15-2022 08:28 PM
@johnnys this can be achieved with the REST Snap Pack and a Netsuite OAuth 2.0 account. I’ll write up instructions for this in the coming days.
07-18-2022 02:00 PM
Netsuite + OAuth 2.0
@johnnys I created an Integration in Netsuite (Setup > Integration > Manage Integrations), enabled REST Web Services and Auth Code Grant under OAuth section and entered in the SnapLogic REST Callback URL (https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/rest
). I copied the generated key and secret also - creation is the only time these are displayed:
You must also enable REST Web Services and OAuth 2.0 as Features (Setup > Company > Enable Features)
In the REST POST Snap, create an OAuth 2.0 account, enter in the key and secret you copied earlier as Client ID and Client Secret.
I enabled Header Authentication.
For “OAuth2 Endpoint” I used https://<ACCOUNT_ID>.app.netsuite.com/app/login/oauth2/authorize.nl
as per the Netsuite documentation.
For “OAuth2 Token” I used https://<ACCOUNT_ID>.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
Grant Type is authorization_code
and the Auth Endpoing config table had a single entry scope
whose value should match the Scope section from earlier (in my case that was restlets,rest_webservices,suite_analytics
).
Authorizing the account was successful and returned an access token and expiration (consider enabling Auto-refresh token also)
Then in the REST POST configuration, I tried to replicate your use case (SuiteQL):
Service URL = https://<my-account-id>.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql
HTTP Entity = {"q":"SELECT 'Hello world!' AS Greeting FROM DUAL"}
(taken from a SuiteQL tutorial)
Lastly, the SuiteQL API requires a request HTTP header Prefer
. I used a value of transient
which I was on the tutorial above:
After configuring the Snap to Validate & Execute, a validation run successfully returned the JSON response from the Netsuite SuiteQL API: