RE: How to create access token using API?
Endpoint:
https://*******-sb1.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token?grant_type=refresh_token
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.