SOAP Web services can be used for extracting vendor details from the NetSuite account. We need to define the SOAP request with the body to fetch the datas. With the SOAP request, we can directly fetch the data from the NetSuite. SOAP is a standard NetSuite API.
Following are the process for the Vendor Bulk extraction:
First, extract all the internal ids of the vendor record using the VENDOR_SEARCH(VendorSearchBasic). In the Vendor search request, the criteria are inactive false and we can also specify the last modified date.For the last modified date filter, the operator is within so needs to specify from DateTime and to DateTime, so SOAP request will extract all the vendors that are active and last modified within the given date.
After the initial request for the VENDOR_SEARCH, we will get the vendor’s internal ids. The results are returned as paginated. The page size of the response results is 1000. So in order to get to the next page, need to call another SOAP request which is SEARCH_MORE_PAGE. In the VENDOR_SEARCH we will get the total records, PageSize, total pages, and PageIndex.
VENDOR_SEARCH will return a search id when we do the initial request for the vendor search. We need to specify this search_id in the SEARCH_MORE_PAGE request. In the SERACH_MORE_PAGE, we can specify the page Index so we will get the vendor details on the specified page.
After getting all the internal ids of the vendor, we need to do the VENDOR_GETLIST(getList Operation) request for getting all the detailed vendor details. In the request, we can specify the multiple internal ids of the vendor record and in the response, we will get the vendor details.
Following are the sample for the SOAP request:
HTTP Method: POST
HTTP URL: https://{COMPANY_ID}.suitetalk.api.netsuite.com/services/NetSuitePort_2021_2
Sample Body:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:messages_2021_2.platform.webservices.netsuite.com"
xmlns:urn1="urn:core_2021_2.platform.webservices.netsuite.com"
xmlns:listRel="urn:relationships_2021_2.lists.webservices.netsuite.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<urn:preferences>
<urn1:bodyFieldsOnly>false</urn1:bodyFieldsOnly>
<urn1:pageSize>10</urn1:pageSize>
</urn:preferences>
<urn:partnerInfo></urn:partnerInfo>
<urn:tokenPassport>
<urn1:account>{{ACCOUNT_ID}}</urn1:account>
<urn1:consumerKey>{{CONSUMER_KEY}}</urn1:consumerKey>
<urn1:token>{{TOKEN_ID}}</urn1:token>
<urn1:nonce>{{nonce}}</urn1:nonce>
<urn1:timestamp>{{timestamp}}</urn1:timestamp>
<urn1:signature algorithm="HMAC-SHA256">{{signature}}</urn1:signature>
</urn:tokenPassport>
</soapenv:Header>
<soapenv:Body>
<search
xmlns="urn:messages_2021_2.platform.webservices.netsu ite.com">
<searchRecord xsi:type="ns9:VendorSearchBasic"
xmlns:ns9="urn:common_2021_2.platform.webservices.netsuite.com">
<ns9:isInactive xsi:type="ns12:SearchBooleanField"
xmlns:ns12="urn:core_2021_2.platform.webservices.netsuite.com">
<ns12:searchValue xsi:type="xsd:boolean">false</ns12:searchValue>
</ns9:isInactive>
<ns9:lastModifiedDate operator="within" xsi:type="ns3:SearchDateField"
xmlns:ns3="urn:core_2021_2.platform.webservices.netsuite.com">
<ns3:searchValue xsi:type="xsd:dateTime">2017-05-21T00:16:17.750Z</ns3:searchValue>
<ns3:searchValue2 xsi:type="xsd:dateTime">2022-02-22T00:17:53.015Z</ns3:searchValue2>
</ns9:lastModifiedDate>
</searchRecord>
</search>
</soapenv:Body>
</soapenv:Envelope>
We will get the line fields in the SOAP response if we define the search preferences. On Default, we will get all the body fields and if we want to get the line fields to need to specify the search preferences as follows:
<urn:preferences>
<urn1:bodyFieldsOnly>false</urn1:bodyFieldsOnly>
<urn1:pageSize>10</urn1:pageSize>
</urn:preferences>
If the bodyFieldsOnly is false we will get all the body and line fields in the response. If this is the case we don’t need to send an extra SOAP call(getList) to fetch all the vendor datas(including line fields). if the bodyFieldsOnly is false, then the response time is higher since all the fields are returning. In order to lessen the response time, we can decrease the pageSize. PageSize can be set in the search preferences.