How to use the suiteql to fetch the data from NetSuite records using postman

The following curl can be used for fetching the data from NetSuite records using Suiteql.

curl --location 'https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0' 
--header 'Content-Type: application/json' 
--header 'Accept: application/json' 
--header 'prefer: transient' 
--header 'Authorization: OAuth realm="[AccountID]",oauth_consumer_key="[CONSUMER_KEY]",oauth_token="[ACCESS_TOKEN]",oauth_signature_method="HMAC-SHA256",oauth_timestamp="1711082395",oauth_nonce="lE426dBrpwV",oauth_version="1.0",oauth_signature="[OAUTH_SIGNATURE]"' 
--data '{
      "q": "SELECT transaction.id AS upstreamId, customer.companyName, customer.entitytitle, customer.entityid, transaction.number, '''D/M/YYYY''' AS dateFormat, transaction.tranDate AS invoiceDate, transaction.dueDate AS paymentDueDate, transaction.total AS invoiceValue, transaction.total AS grossAmount, transactionShippingAddress.addr1 AS shippingAddress1, transactionShippingAddress.addr2 AS shippingAddress2, transactionShippingAddress.city AS shipToCity, transactionShippingAddress.state AS shipToState, transactionShippingAddress.zip AS shipToPincode, transactionShippingAddress.country AS shipToCountry, transactionBillingAddress.addr1 AS billingAddress1, transactionBillingAddress.addr2 AS billingAddress2, transactionBillingAddress.city AS billToCity, transactionBillingAddress.state AS billToState, transactionBillingAddress.zip AS billToPincode, transactionBillingAddress.country AS billToCountry, item.itemid AS productId, item.description AS productDescription, unitstype.name AS productUnit, transactionLine.rate AS productRate, transactionLine.taxrate1 AS taxPercent, transaction.exchangerate AS exchangeRate, transactionLine.rateamount, transactionLine.netamount, transactionLine.quantity AS productQuantity, transactionLine.memo, contact.id AS contactId, contact.entityid AS contactName, contact.email AS contactEmail, contact.mobilephone AS contactMobile, contact.homephone AS contactLandLine, currency.symbol AS currencyCode, transaction.transactionnumber, transaction.subsidiary,sub.name AS SubsidiaryName, parentSub.name AS ParentSubsidiary, transaction.type AS type, transaction.foreignamountunpaid AS balance, transaction.foreignamountpaid AS paymentReceived, transaction.foreigntotal AS billingAmount, transaction.currency AS billingCurrencyCode, employee.email AS collectorEmail FROM TRANSACTION TRANSACTION LEFT JOIN transactionLine transactionLine ON transaction.id = transactionLine.transaction RIGHT JOIN item item ON transactionLine.item = item.id LEFT JOIN customer customer ON customer.id = transaction.entity LEFT JOIN transactionBillingAddress transactionBillingAddress ON transactionBillingAddress.nkey = transaction.billingaddress LEFT JOIN transactionShippingAddress transactionShippingAddress ON transactionShippingAddress.nkey = transaction.shippingaddress LEFT JOIN employee employee ON transaction.employee = employee.id LEFT JOIN unitstype unitstype ON transactionLine.units = item.unitstype LEFT JOIN contact contact ON customer.contact = contact.id LEFT JOIN currency currency ON transaction.currency = currency.id LEFT JOIN subsidiary sub ON transaction.subsidiary = sub.id LEFT JOIN subsidiary parentSub ON sub.parent = parentSub.id where abbrevtype = '''INV''' AND (sub.id=10 OR sub.parent IS NULL)"
}'

Leave a comment

Your email address will not be published. Required fields are marked *