I am able to see a welcome message when I pass the...
# suitetalkapi
s
I am able to see a welcome message when I pass the credentials into a 'get' method. When I do a 'post' method, I get the invalid user login error. The Audit log shows only the 'get' calls and not the 'post' calls. Is there some authorization needed?
b
this doesnt sound like you are using soap
what url are you sending requests to
and what are your headers and body
s
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header> <tokenPassport> <account>{{ACCOUNT}}</account> <consumerKey>{{CONSUMER_KEY}}</consumerKey> <token>{{TOKEN_ID}}</token> <nonce>{{nonce}}</nonce> <timestamp>{{timestamp}}</timestamp> <signature algorithm="HMAC-SHA256">{{signature}}</signature> </tokenPassport> <preferences> <runServerSuiteScriptAndTriggerWorkflows> false </runServerSuiteScriptAndTriggerWorkflows> </preferences> <searchPreferences> <pageSize>1000</pageSize> <bodyFieldsOnly>false</bodyFieldsOnly> </searchPreferences> </soap-env:Header> <soap-env:Body> <get xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformCore="urn:core_2020_1.platform.webservices.netsuite.com"> <baseRef internalId="257" type="customList" xsi:type="platformCore:RecordRef"> <platformCore:name/> </baseRef> </get> </soap-env:Body> </soap-env:Envelope>
How can I check the correct URL for the sandbox?
b
from the ui, you can use Company Information
programatically is getDataCenterUrls
the path of the url is basically what you have, although you probably want
/services/NetSuitePort_2020_1
given that your platform core namespace is 2020_1
otherwise your body looks fine, so you should make sure that the environmental variables are correct and that your pre request scripts is setup correctly
it looks like you are using https://www.zuar.com/blog/netsuite-api-exploring-soap/, in which case i would double check that your code has been correctly updated to use HmacSHA256
s
Correct. The post uses SHA1 in their JS to generate the signature. Looks like the blog is not updated with the code to generate SHA256. Can you assist to check the code below
let account = pm.environment.get("ACCOUNT"); let consumerKey = pm.environment.get("CONSUMER_KEY"); let consumerSecret = pm.environment.get("CONSUMER_SECRET"); let tokenId = pm.environment.get("TOKEN_ID"); let tokenSecret = pm.environment.get("TOKEN_SECRET"); let timestamp = new Date().getTime().toString().substring(0, 10); let nonce = CryptoJS.lib.WordArray.random(10).toString(); let baseString = `${account}&${consumerKey}&${tokenId}&${nonce}&${timestamp}`; let key = `${consumerSecret}&${tokenSecret}`; let signature = CryptoJS.HmacSHA256(baseString, key).toString(CryptoJS.enc.Base64); pm.environment.set("signature", signature); pm.environment.set("nonce", nonce); pm.environment.set("timestamp", timestamp);
b
scripts looks right