How to create access token using API?

Endpoint:

https://*******-sb1.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token?grant_type=refresh_token

 Header: grant_type
what is the best practice to generate access token from API?
Rookie Asked on February 21, 2023 in How To's.
Add Comment
2 Answer(s)

Hi,

Are you intending to use the OAuth2 flow here?

You mention refresh_token. Have you already generated the initial token?

The reason I ask this is that there are server-to-server options that do not require user input.

Thanks,

Chris

Intermediate Answered on February 23, 2023.
Add Comment

To create an access token using the API in NetSuite, you can follow these steps:

1. Log in to your NetSuite account as an administrator.
2. Navigate to “Setup” in the top navigation menu and select “Integration” under the “Integration” section.
3. Click on “Manage Integrations.”
4. On the “Integration” page, click on the “New” button to create a new integration.
5. Fill in the required details for your integration, including the name and any other necessary information.
6. Under the “Authentication” section, select “Token-Based Authentication” as the authentication method.
7. Choose the desired level of permission for the access token under the “Authentication Tokens” section.
8. Click on the “Save” button to create the integration and generate the access token.

After saving the integration, NetSuite will generate an access token along with other credentials like a consumer key and a consumer secret. Make sure to store these credentials securely as they are crucial for making API calls to NetSuite.

With the access token in hand, you can use it in your API requests by including it in the Authorization header. Here’s an example of how you can include the access token using cURL:

“`shell
curl -X GET \
-H “Authorization: Bearer YOUR_ACCESS_TOKEN” \
https://<YOUR_ACCOUNT_ID>.suitetalk.api.netsuite.com/services/NetSuitePort_<NETSUITE_API_VERSION>
“`

Replace `YOUR_ACCESS_TOKEN` with the actual access token you obtained. Also, replace `<YOUR_ACCOUNT_ID>` with your NetSuite account ID, and `<NETSUITE_API_VERSION>` with the desired version of the NetSuite API you’re using.

Remember to refer to the NetSuite API documentation for further details on the endpoints and parameters relevant to your specific integration.

Rookie Answered on May 17, 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   Become a Sponsor   Become a Sponsor