Forum Discussion
Hi @manohar,
If I understand correctly, you don’t need those fields in the final result, if their value is null ?
If that’s the case, you can try the following expression:
sl.ensureArray($attachments.attachment.filter((v,k)=>v!=null))
and map the Target path as $attachments only.
Let me know if this helps,
Bojan
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 entryscope
whose value should match the Scope section from earlier (in my case that wasrestlets,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 oftransient
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:
Hi. I’m really not sure why our REST snap’s OAuth 1 account type is requiring so many things that Postman does not (the Endpoints), and not allowing you to enter some of the values that you do need to specify (the Token and Token Secret). I’m unfamiliar with our REST OAuth1 account type. It seems to be designed for some other OAuth 1 use case for a different SAS.
Let me ask this: Are you trying to call a NetSuite RESTlet or are you trying to call NetSuite’s REST API? They are different. We have a new NetSuite RESTlet snap that can be used for RESTlets, but we don’t yet have direct support in our NetSuite snap pack for calling the NetSuite REST API. It’s planned for a future release.
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
Is it possible to setup a call to discuss this and what my options are to accomplish this request?
Thanks,
Johnny
Hi Johnny. I think you may not have any great options for calling the SuiteQL API via REST with our snaps in the short term with the current limitations of our REST OAuth1 account type. I have learned that this account type was designed around a particular way of using OAuth1 for a particular SAS but it’s clearly not going to work with NetSuite.
Until we address this (which is not on our roadmap currently as far as I know), your other options involve our NetSuite snap pack:
-
Write a NetSuite RESTlet that does what you need. That’s a script that you write and install in your NetSuite account. You would then use our new NetSuite Call RESTlet snap to call it from a pipeline, and it executes on the NetSuite server. The script can access a variety of NetSuite server-side APIs to access your data. Our snap handles the complexity of NetSuite’s OAuth1 authentication. This is a new snap that will be included in our May release, but is also available now as a patch for our Feb release. We have two customers using it.
-
See if our other NetSuite snaps might do what you need. They use NetSuite’s SOAP-based SuiteTalk API. Many of our customers have found these sufficient for their needs.
We are planning on eventually providing more direct support in our NetSuite snap pack for NetSuite’s newer REST-based APIs (apart from RESTlets). These APIs are new in the past year, I believe.
Hope that helps.
-
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
Related Content
- 3 months ago
- 10 months ago
- 3 years ago
- 5 years ago