Skip to content

Instantly share code, notes, and snippets.

@W3BGUY
Last active February 8, 2023 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save W3BGUY/9a15db3931c903a8b1977f30ff5a0843 to your computer and use it in GitHub Desktop.
Save W3BGUY/9a15db3931c903a8b1977f30ff5a0843 to your computer and use it in GitHub Desktop.
Postman setup for NetSuite SOAP customer upsert
Method: POST
URL: https://123456-sb1.suitetalk.api.netsuite.com/services/NetSuitePort_2022_2
Add headers:
Content-Type: text/xml
SOAPAction: upsert
Body:
<soapenv:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:platformCore='urn:core_2022_2.platform.webservices.netsuite.com'
xmlns:tranSales='urn:sales_2022_2.transactions.webservices.netsuite.com'
xmlns:platformMsgs='urn:messages_2022_2.platform.webservices.netsuite.com'>
<soapenv:Header>
<tokenPassport xsi:type='platformCore:TokenPassport'>
<account xsi:type='xsd:string'>{{account}}</account>
<consumerKey xsi:type='xsd:string'>{{consumerKey}}</consumerKey>
<token xsi:type='xsd:string'>{{tokenId}}</token>
<nonce xsi:type='xsd:string'>{{nonce}}</nonce>
<timestamp xsi:type='xsd:long'>{{timestamp}}</timestamp>
<signature algorithm='HMAC_SHA256' xsi:type='platformCore:TokenPassportSignature'>{{signature}}</signature>
</tokenPassport>
</soapenv:Header>
<soapenv:Body>
<upsert xsi:type='platformMsgs:upsertRequest'>
<record xsi:type="ns1:Customer" externalId="TEST_20230207" xmlns:ns1="urn:relationships_2022_2.lists.webservices.netsuite.com">
<companyName>Ima SOAP test</companyName>
<email>Imatest@soap.com</email>
</record>
</upsert>
</soapenv:Body>
</soapenv:Envelope>
Pre-request Script:
let account='123456_SB1';
let consumerKey='XXXXX';
let consumerSecret=' XXXXX ';
let tokenId=' XXXXX ';
let tokenSecret=' XXXXX ';
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("account",account);
pm.environment.set("consumerKey",consumerKey);
pm.environment.set("tokenId",tokenId);
pm.environment.set("nonce",nonce);
pm.environment.set("timestamp",timestamp);
pm.environment.set("signature",signature);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment