import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
netsuite: {
type: "app",
app: "netsuite",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://${this.netsuite.$auth.account_id}.suitetalk.api.netsuite.com/services/rest/record/v1/customer`,
headers: {
Authorization: `Bearer ${this.netsuite.$auth.oauth_access_token}`,
},
params: {
limit: `10`,
},
})
},
})
NetSuite uses OAuth authentication. When you connect your NetSuite account, Pipedream will open a popup window where you can sign into NetSuite and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any NetSuite API.
Pipedream requests the following authorization scopes when you connect your account:
rest_webservicesGEThttps://system.netsuite.com/app/login/oauth2/authorize.nl?client_id={{oauth.client_id}}&redirect_uri={{oauth.redirect_uri}}&state={{oauth.state}}&response_type=code&scope={{oauth.space_separated_scopes}}&prompt=consentPOSThttps://{{custom_fields.account_id}}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsonredirect_uri={{oauth.redirect_uri}}&grant_type=authorization_code&code={{oauth.code}}POSThttps://{{custom_fields.account_id}}.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsongrant_type=refresh_token&refresh_token={{oauth.refresh_token}}