Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
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'}]}