SOAP Queries

You can query entities in SOAP using the WSDL for the API version you are working in:

https://my.tractbilling.com/t/s/billing/<version>?wsdl

The simplest request contains only the type of entity you are returning. You can return paged lists by setting the pageSize and pageNumber attributes of simpleDataQuery.

To return a specific entity or entities, use query keys. Most entities have more than one key that can be passed in parameter to filter results.

Many queries MUST contain a query key.

More information about query keys, including a list of all entities, their keys, and which queries require a key refer to Query Keys.

Request Model

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:query xmlns="http://www.tractbilling.com/billing/1_28/domain">
            <ns2:queryRequest queryScope="">
                <simpleDataQuery pageSize="" pageNumber="">
                    <type></type>
                    <parameter parameter="" parameterValue=""/>
                </simpleDataQuery>
            </ns2:queryRequest>
        </ns2:query>
    </soap:Body>
</soap:Envelope>
Parameters
Parameter Required?

Datatype

Attributes | Datatype | Required?
query

Y

-
queryRequest

Y

- -queryScope | string
simpleDataQuery

Y

- -pageNumber | int
-pageSize | int
-type

Y

string

-parameter

N

parameter

-parameter | string | required
-parameterValue | string
-operator | string

pageNumber

N

int
pageSize

N

int

Simple Query

Below is the simplest query - an unpaged list of instances of the entity. The number of entities returned is set by the Max Number of API Entities Returned in Query Response system setting.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:query xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:queryRequest>
                <simpleDataQuery>
                    <type>BillingAccount</type>
                </simpleDataQuery>
            </ns2:queryRequest>
        </ns2:query>
    </soap:Body>
</soap:Envelope>		

The response (truncated after the third billing account):

                <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:queryResponse xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:return successful="true">
                <billingAccounts pageNumber="1" pageSize="50" totalElements="26" elementCount="26" totalPages="1">
                    <billingAccount accountNum="100" billType="NONE" automaticRecurringPayment="false" status="ACTIVE" pendingChargesTotal="0.00" balance="0.00" startDate="2014-02-12T18:39:37.000-06:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-02-12T00:00:00.000-06:00" eid="1" queryScope="SHALLOW">
                        <monthlyBillCycle eid="1" queryScope="EID"/>
                        <organization eid="2" queryScope="EID"/>
                        <billingAccountCategory eid="1" queryScope="EID"/>
                        <services pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm eid="1" queryScope="EID"/>
                    </billingAccount>
                    <billingAccount accountNum="101" billType="NONE" automaticRecurringPayment="false" status="ACTIVE" pendingChargesTotal="0.00" balance="0.00" startDate="2014-07-16T17:08:37.000-05:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-02-12T00:00:00.000-06:00" eid="56" queryScope="SHALLOW">
                        <monthlyBillCycle eid="1" queryScope="EID"/>
                        <organization eid="60" queryScope="EID"/>
                        <billingAccountCategory eid="1" queryScope="EID"/>
                        <services pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm eid="1" queryScope="EID"/>
                    </billingAccount>
                    <billingAccount accountNum="102" billType="NONE" automaticRecurringPayment="false" status="ACTIVE" pendingChargesTotal="0.00" balance="0.00" startDate="2014-07-17T09:45:44.000-05:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-02-12T00:00:00.000-06:00" eid="92" queryScope="SHALLOW">
                        <monthlyBillCycle eid="1" queryScope="EID"/>
                        <organization eid="98" queryScope="EID"/>
                        <billingAccountCategory eid="1" queryScope="EID"/>
                        <services pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm eid="1" queryScope="EID"/>
**//truncated //**

Paged List

Below is the same query - all billing accounts, but paged in increments of 10 accounts, returning page 1.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:query xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:queryRequest>
                <simpleDataQuery pageSize="2" pageNumber="1">
                    <type>BillingAccount</type>
                </simpleDataQuery>
            </ns2:queryRequest>
        </ns2:query>
    </soap:Body>
</soap:Envelope>        

The response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:queryResponse xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:return successful="true">
                <billingAccounts pageNumber="1" pageSize="2" totalElements="1099" elementCount="2" totalPages="550">
                    <billingAccount accountNum="1" billType="EMAIL" automaticRecurringPayment="false" status="ACTIVE" pendingChargesTotal="0.00" balance="-7461.00" startDate="2014-08-01T00:00:00.000-05:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-08-04T00:00:00.000-05:00" eid="2876" queryScope="DEEP">
                        <dailyBillCycle name="Daily BC 1" startDate="2015-09-22T00:00:00.000-05:00" endDate="2015-09-23T00:00:00.000-05:00" billCycleType="Daily" autoBill="false" status="ACTIVE" currencyType="USD" eid="214" queryScope="DEEP"/>
                        <organization name="Lockbox Test" eid="2938" queryScope="DEEP">
                            <addresses>
                                <postalAddress purpose="BILLING" country="USA" city="Austin" regionOrState="TX" postalCode="78701" line1="620 Congress Avenue" eid="17226" queryScope="DEEP"/>
                                <emailAddress purpose="PRIMARY" email="usman.ghani@algoworks.com" eid="17228" queryScope="DEEP"/>
                            </addresses>
                        </organization>
                        <billingAccountCategory type="All Accounts" description="Default billing account category" status="BA_CATEGORY_ACTIVE" eid="80" queryScope="DEEP"/>
                        <services pageNumber="1" pageSize="50" totalElements="4" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="3" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm name="Immediate" termDays="0" graceDays="0" eid="134" queryScope="DEEP"/>
                    </billingAccount>
                    <billingAccount accountNum="2" billType="EMAIL" automaticRecurringPayment="false" status="ACTIVE" pendingChargesTotal="0.00" balance="1104.00" startDate="2014-08-25T00:00:00.000-05:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-08-04T00:00:00.000-05:00" eid="16300" queryScope="DEEP">
                        <dailyBillCycle name="Daily BC 1" startDate="2015-09-22T00:00:00.000-05:00" endDate="2015-09-23T00:00:00.000-05:00" billCycleType="Daily" autoBill="false" status="ACTIVE" currencyType="USD" eid="214" queryScope="DEEP"/>
                        <organization name="Charge Info" eid="16744" queryScope="DEEP">
                            <addresses>
                                <postalAddress purpose="BILLING" country="USA" city="Austin" regionOrState="TX" postalCode="78701" line1="620 Congress Avenue" eid="38360" queryScope="DEEP"/>
                                <emailAddress purpose="PRIMARY" email="usman.ghani@algoworks.com" eid="38362" queryScope="DEEP"/>
                            </addresses>
                        </organization>
                        <billingAccountCategory type="All Accounts" description="Default billing account category" status="BA_CATEGORY_ACTIVE" eid="80" queryScope="DEEP"/>
                        <services pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm name="Immediate" termDays="0" graceDays="0" eid="134" queryScope="DEEP"/>
                    </billingAccount>
                </billingAccounts>
            </ns2:return>
        </ns2:queryResponse>
    </soap:Body>
</soap:Envelope>      

A Specific Entity

Below is a query for a specific account by account number. Note the DEEP queryScope; which returns verbose results for all entities within the billing account.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:query xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:queryRequest queryScope="DEEP">
                <simpleDataQuery >
                    <type>BillingAccount</type>
                    <parameter parameter="accountNum" parameterValue="1089"/>
                </simpleDataQuery>
            </ns2:queryRequest>
        </ns2:query>
    </soap:Body>
</soap:Envelope>       

The response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:queryResponse xmlns="http://www.tractbilling.com/billing/1_28/domain" xmlns:ns2="http://www.tractbilling.com/billing/1_28/service">
            <ns2:return successful="true">
                <billingAccounts pageNumber="1" pageSize="50" totalElements="1" elementCount="1" totalPages="1">
                    <billingAccount accountNum="1089" billType="EMAIL" automaticRecurringPayment="true" status="ACTIVE" pendingChargesTotal="0.00" balance="-10.09" startDate="2015-09-17T16:43:04.000-05:00" taxExempt="false" currencyType="USD" nextInvoiceDate="2014-08-04T00:00:00.000-05:00" eid="51800" queryScope="DEEP">
                        <dailyBillCycle name="Daily BC 1" startDate="2015-09-22T00:00:00.000-05:00" endDate="2015-09-23T00:00:00.000-05:00" billCycleType="Daily" autoBill="false" status="ACTIVE" currencyType="USD" eid="214" queryScope="DEEP"/>
                        <organization name="Hole In The Wall" eid="55572" queryScope="DEEP">
                            <addresses>
                                <postalAddress purpose="SERVICE" country="USA" city="Austin" regionOrState="TX" postalCode="78705" line1="100 Guadalupe" eid="205432" queryScope="DEEP"/>
                                <postalAddress purpose="BILLING" country="USA" city="Austin" regionOrState="TX" postalCode="78705" line1="100 Guadalupe" eid="205434" queryScope="DEEP"/>
                                <emailAddress purpose="PRIMARY" email="ialexander@gotransverse.com" eid="205436" queryScope="DEEP"/>
                                <telecomAddress purpose="OFFICE" countryCode="1" areaCode="512" number="7738577" eid="205438" queryScope="DEEP"/>
                            </addresses>
                        </organization>
                        <recurringPayments pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <billingAccountCategory type="All Accounts" description="Default billing account category" status="BA_CATEGORY_ACTIVE" eid="80" queryScope="DEEP"/>
                        <services pageNumber="1" pageSize="50" totalElements="1" elementCount="0" totalPages="1"/>
                        <pendingCharges pageNumber="1" pageSize="50" totalElements="2" elementCount="0" totalPages="1"/>
                        <customFieldValues pageNumber="1" pageSize="50" totalElements="0" elementCount="0" totalPages="0"/>
                        <paymentTerm name="Net 30" termDays="30" graceDays="0" eid="136" queryScope="DEEP"/>
                    </billingAccount>
                </billingAccounts>
            </ns2:return>
        </ns2:queryResponse>
    </soap:Body>
</soap:Envelope>