RE: Why does my SuiteQL POST request work when I use Postman, but when I cURL the same code in VS Code terminal, it returns ‘INVALID_LOGIN’

I’m trying to use SuiteQL to query a workbook, but I’m having trouble getting it to work in VS Code. I downloaded the Postman environment template and collections archive from the SuiteTalk tools download page and then sent a test request. It returned a successful JSON response. I then tried to send the same sample request using cURL in the VS Code terminal, then with node-fetch, and then using an npm library called netsuite-rest. All of these return 401 ‘INVALID_LOGIN’. Why does it work when I use Postman, but nowhere else? Here’s a sample of my cURL request:

curl --location --request POST 'https://<ACCOUNT_ID>' \
--header 'prefer: transient' \
--header 'Content-Type: application/json' \
--header 'Authorization: OAuth realm="<ACCOUNT_ID>",oauth_consumer_key="<CONSUMER_KEY>",oauth_token="<TOKEN>",oauth_signature_method="HMAC-SHA256",oauth_timestamp="<TIMESTAMP>",oauth_nonce="<NONCE>",oauth_version="1.0",oauth_signature="<SIGNATURE>"' \
--data-raw '{
    "q": "SELECT id, companyName, email, dateCreated FROM customer WHERE dateCreated >= '\''01/01/2019'\'' AND dateCreated < '\''01/01/2020'\''"

RomanEmmons Rookie Asked on August 18, 2020 in SuiteTalk.
Add Comment
2 Answers


There are plenty of places to go wrong with this unfortunately. I’d recommend having a look at these:

And then check specifically:
* Alphabetical sorting of parameters.
* URL encoding.



Intermediate Answered on August 19, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.