I'm working on moving all of our current Netsuite integrations from Netsuite 1.0 to 2.0. In doing so I'm testing out the SuiteTalk API using our Netsuite Sandbox account
I've completed the following steps.
- Created a new role 'Token Role' with Full permissions "Log in using Access Tokens" and "Access Token Management".
- Created a new integration (LogosTest) and checked the boxes for TBA, Oauth2.0 and User Credentials, added
- I've given user E111 (myself) roles Token Role and Administrator.
- Created an Access Token with role Token Role, user is set to E111, and application is LogosTest.
I've saved the consumer key/consumer id, token id and token secret however, when trying to test with a customer id 1113 using suitetalk I see this error in the Login Audit Trail — EntityOrRoleDisabled.
I'm attaching the Python script I'm using that populated the 401 EntityOrRoleDisabled error message.Any guidance on this would be greatly appreciated.
Thank you,
This is the code I'm using:
record_type = "customer"
record_id = "1113" # internl id... its in url
url = f"https://{NETSUITE_ACCOUNT_ID.lower().replace('_', '-')}.suitetalk.api.netsuite.com/services/rest/record/v1/{record_type}/{record_id}"
try:
oauth = OAuth1(
client_key=CLIENT_ID,
client_secret=CLIENT_SECRET,
resource_owner_key=TOKEN_ID,
resource_owner_secret=TOKEN_SECRET,
signature_method='HMAC-SHA256',
realm=NETSUITE_ACCOUNT_ID
)
headers = {
'Content-Type': 'application/json'
}
r = requests.get(url=url, headers=headers, auth=oauth)
if r.status_code == 200:
print("Success...")
print(json.dumps(r.json(), indent=2))
else:
print("Failed")
print(r.text)
except Exception as e:
print(f"A script error occurred: {e}")