Discussions
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Unable to make REST Web Service suiteql work in Python
Trying out a suiteql query through the rest service and it does not appear to be working. I am trying the example as per: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157909186990.html
url_q = "https://xxxxxx.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=10&offset=10"
header_q = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + access_token,
"Prefer": "transient"
}
r = requests.post(url_q, headers=header_q, data={"q": "SELECT COUNT(*) as count FROM account"})
print(r.json())
This produces the below error code:
{'type': 'https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1', 'title': 'Bad Request', 'status': 400, 'o:errorDetails': [{'detail': 'Invalid content in the request body.', 'o:errorCode': 'INVALID_CONTENT'}]}