# XML-RPC Invoice Table query not working

**URL:** <https://integration.keap.com/t/xml-rpc-invoice-table-query-not-working/91097>\
**Category:** API Q&A\
**Created:** [July 26, 2023, 3:14pm UTC](https://integration.keap.com/t/xml-rpc-invoice-table-query-not-working/91097 "2023-07-26T15:14:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Basel\_Anani](https://avatars.discourse-cdn.com/v4/letter/b/e9a140/32.png) [@Basel\_Anani](https://integration.keap.com/u/Basel_Anani)\
**Post date:** [July 26, 2023, 3:14pm UTC](https://integration.keap.com/t/xml-rpc-invoice-table-query-not-working/91097/1 "2023-07-26T15:14:32Z")

</div>

I pulled a query directly from the sample query that’s given aka the DataService.query method the goal is to list all invoices for a specific client to begin with. I am getting `Failed to invoke method query in class com.infusionsoft.api.xmlrpc.XmlRpcDataService: null`. Is something wrong with DataService.query method perhaps or is this related to the Invoice table only? Attached below is my query with identifying information anonymized

```xml
<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>DataService.query</methodName>
  <params>
    <param>
      <value><string>{MyAPIKey]</string></value>
    </param>
    <param>
      <value><string>Invoice</string></value>
    </param>
    <param>
      <value><int>1</int></value>
    </param>
    <param>
      <value><int>0</int></value>
    </param>
    <param>
      <value><struct>
        <!-- Empty struct to select all -->
      </struct></value>
    </param>
    <param>
      <value><array>
        <data>
          <value><string>Id</string></value>
          <value><string>ContactId</string></value>
        </data>
      </array></value>
    </param>
    <param>
      <value><string>orderBy</string></value>
    </param>
    <param>
      <value><boolean>1</boolean></value>
    </param>
  </params>
</methodCall>

```

---

<div class="post-metadata">

**Author:** ![TomScott](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/tomscott/32/67_2.png) [@TomScott](https://integration.keap.com/u/TomScott)\
**Post date:** [July 26, 2023, 5:19pm UTC](https://integration.keap.com/t/xml-rpc-invoice-table-query-not-working/91097/2 "2023-07-26T17:19:43Z")

</div>

You appear to have an `orderBy` in there in a place where the proper value should be the column name. Try changing it to `Id` and it should work correctly.

---

<div class="post-metadata">

**Author:** ![Basel\_Anani](https://avatars.discourse-cdn.com/v4/letter/b/e9a140/32.png) [@Basel\_Anani](https://integration.keap.com/u/Basel_Anani)\
**Post date:** [July 26, 2023, 5:24pm UTC](https://integration.keap.com/t/xml-rpc-invoice-table-query-not-working/91097/4 "2023-07-26T17:24:15Z")

</div>

Tom with the save again thanks! I thought the term orderBy there was a hard string and not a field that we needed to place a value in
