SWAPI – Change Queries

 

CustomerChangeQuery. 1

InvoiceChangeQuery. 2

SWAPI Pagination. 2

 

CustomerChangeQuery

This command can be used to retrieve a list of customers that have changed since the date specified.  Changes that will result in a customer showing up in this query consist of

·         Changes to service location or billing account name, address, phone number, email, location type, lead source, or communication preferences (optin, optout).

·         Activating or terminating agreements for the location.

 

This command requires the use of pagination.

Request

<SessionRequest RequestID="string" SessionID="{0CDFB15E-66AC-4156-858C-4027CDDDF13A}" Version="string">

  <CustomerChangeQuery PageNo="string" PageSize="string" StyleOptions="string" StyleNo="string" OrderBy="string" Max="string" Filter="string">

    <ChangedSince>2016-03-30T16:57:14</ChangedSince>

  </CustomerChangeQuery>

</SessionRequest>

 

·         Note that the parameter ChangedSince is required. 

·         ChangedSince uses date time format as YYYY-MM-DDThh:mm:ss.

·         This time is Coordinated Universal Time (Zulu time) format without a time zone designator.

·         This command supports pagination which should be used to prevent large datasets.

 

This command requires the use of pagination.

Response

<?xml version="1.0"?>

<CustomerChangeQueryData RequestID="string">

  <CustomerChangeQueryRecord>

    <LocationID>integer</LocationID>

    <LocationFirstName>string(25)</LocationFirstName>

    <LocationLastName>string(35)</LocationLastName>

    <LocationCompanyName>string(35)</LocationCompanyName>

    <LocationAddress1>string(35)</LocationAddress1>

    <LocationAddress2>string(35)</LocationAddress2>

    <LocationCity>string(20)</LocationCity>

    <LocationState>string(2)</LocationState>

    <LocationZip>string(10)</LocationZip>

    <LocationPhone1>string(12)</LocationPhone1>

    <LocationEmailAddress>string(150)</LocationEmailAddress>

    <HasAgreement>boolean</HasAgreement>

    <HasPerpetualAgreement>boolean</HasPerpetualAgreement>

    <AgreementStartDate>dateTime</AgreementStartDate>

    <AgreementEndDate>dateTime</AgreementEndDate>

    <LocationLocationType>string(6)</LocationLocationType>

    <LocationLeadSource>string(6)</LocationLeadSource>

    <BillingAccountID>integer</BillingAccountID>

    <BillingFirstName>string(25)</BillingFirstName>

    <BillingLastName>string(35)</BillingLastName>

    <BillingCompanyName>string(35)</BillingCompanyName>

    <BillingAddress1>string(35)</BillingAddress1>

    <BillingAddress2>string(35)</BillingAddress2>

    <BillingCity>string(20)</BillingCity>

    <BillingState>string(2)</BillingState>

    <BillingZip>string(10)</BillingZip>

    <BillingPhone1>string(12)</BillingPhone1>

    <BillingEmailAddress>string(150)</BillingEmailAddress>

    <DoNotSolicit>boolean</DoNotSolicit>

    <NoHappyChecks>boolean</NoHappyChecks>

    <dsCustChangeBillingCommPrefList>

      <dsCustChangeBillingCommPref>

        <CommClass>string(25)</CommClass>

        <OptInRequired>boolean</OptInRequired>

        <OptIn>boolean</OptIn>

        <OptOut>boolean</OptOut>

      </dsCustChangeBillingCommPref>

    </dsCustChangeBillingCommPrefList>

    <dsCustChangeLocationCommPrefList>

      <dsCustChangeLocationCommPref>

        <CommClass>string(25)</CommClass>

        <OptInRequired>boolean</OptInRequired>

        <OptIn>boolean</OptIn>

        <OptOut>boolean</OptOut>

      </dsCustChangeLocationCommPref>

    </dsCustChangeLocationCommPrefList>

  </CustomerChangeQueryRecord>

</CustomerChangeQueryData>

InvoiceChangeQuery

This command can be used to retrieve a list of new invoices since the date supplied.  This list will also include any invoices that have been adjusted and reposted or voided since that date.

Request

<SessionRequest RequestID="string" SessionID="{0CDFB15E-66AC-4156-858C-4027CDDDF13A}" Version="string">

  <InvoiceChangeQuery PageNo="string" PageSize="string" StyleOptions="string" StyleNo="string" OrderBy="string" Max="string" Filter="string">

    <ChangedSince>2016-03-30T17:26:30</ChangedSince>

  </InvoiceChangeQuery>

</SessionRequest>

 

·         Note that the parameter ChangedSince is required. 

·         ChangedSince uses date time format as YYYY-MM-DDThh:mm:ss.

·         This time is Coordinated Universal Time (Zulu time) format without a time zone designator.

·         This command supports pagination which should be used to prevent large datasets.

Response

<?xml version="1.0"?>

<InvoiceChangeQueryData RequestID="string">

  <InvoiceChangeQueryRecord>

    <InvoiceID>integer</InvoiceID>

    <InvoiceDate>dateTime</InvoiceDate>

    <BillingAccountID>integer</BillingAccountID>

    <LocationID>integer</LocationID>

    <InvoiceNo>string(10)</InvoiceNo>

    <JobNo>string(10)</JobNo>

    <JobClass>string(15)</JobClass>

    <JobType>string(6)</JobType>

    <JobLeadSource>string(6)</JobLeadSource>

    <JobLeadSourceType>string(16)</JobLeadSourceType>

    <JobDepartment>string(2)</JobDepartment>

    <InvoiceDepartment>string(2)</InvoiceDepartment>

    <InvoiceSubTotal>float</InvoiceSubTotal>

    <InvoiceTotalAmount>float</InvoiceTotalAmount>

    <InvoiceNetBalance>float</InvoiceNetBalance>

    <dsInvoiceChangeItemList>

      <dsInvoiceChangeItem>

        <InvoiceID>integer</InvoiceID>

        <ItemNumber>string(15)</ItemNumber>

        <Quantity>float</Quantity>

        <UnitPrice>float</UnitPrice>

        <TotalSale>float</TotalSale>

        <DiscountAmount>float</DiscountAmount>

        <TotalAfterDiscount>float</TotalAfterDiscount>

        <ChargeTo>string(1)</ChargeTo>

      </dsInvoiceChangeItem>

    </dsInvoiceChangeItemList>

  </InvoiceChangeQueryRecord>

</InvoiceChangeQueryData>

SWAPI Pagination

Some datasets returned by SWAPI can be quite large.  To avoid pulling too much data at one time and risking time outs and disconnects, the commands support pagination.

 

 

Post

 

 

 

 

 

 

 

 

 

Reply

 

For commands that support pagination, pages can be requested using the attributes PageSize and PageNo.

 

<SessionRequest SessionID="{4679A42B-C0A2-44AD-A804-F86DDD2A21D5}" RequestID="0ab214e">

  <PricebookItemQuery PageSize="100" PageNo="2">

    <LastUpdated>2001-03-29T14:10:44</LastUpdated>

    <ItemType>p</ItemType>

  </PricebookItemQuery>

</SessionRequest>

 

The resulting XML for paginated requests will include pagination attributes for PageSize, PageNo and PageCountPageCount indicates the total number of pages of data available for that PageSize.

 

<PricebookItemQueryResponse Successful="true" ResultCode="000" ResultText="Successful" Version="1.8.800.16" RequestID="string">

  <PricebookItemQueryData ReturnedRows="0" FilteredRows="0" TotalRows="0" PageSize="100" PageNo="2" PageCount="1" QueryOptions="LastUpdated=3/29/2001 2:10:44 PM, ItemType=p"/>

</PricebookItemQueryResponse>