Query

You can use QuickBooks queries to look up just about anything.

Note, queries are read only.

Format example:

Select Statement = SELECT * | count(*) FROM IntuitEntity
   [WHERE WhereClause]
   [ORDERBY OrderByClause]
   [STARTPOSITION  Number] [MAXRESULTS  Number]

You can learn more about the format on Intuit's website: https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries#uri-for-query

Query Attributes: * required * conditionally required

Parameter Data Type Description
* query string SQL code for query

Request

curl -X "POST" "https://snapbooksapi.com/api/v1/query" \
     -H 'X-Api-Key: xxx' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "query": "SELECT * FROM Class"
}'

Response

{
  "success": true,
  "type": "Operation",
  "message": "",
  "details": [],
  "results": [
    {
      "Name": "Test Class",
      "SubClass": "false",
      "ParentRef": null,
      "FullyQualifiedName": "Test Class",
      "Active": "true",
      "ClassEx": null,
      "Id": "5000000000000135140",
      "SyncToken": "0",
      "MetaData": {
        "CreatedByRef": null,
        "CreateTime": "2019-11-13T09:38:57-08:00",
        "LastModifiedByRef": null,
        "LastUpdatedTime": "2019-11-13T09:38:57-08:00",
        "LastChangedInQB": null,
        "Synchronized": null
      },
      "CustomField": null,
      "AttachableRef": null,
      "domain": null,
      "status": null,
      "sparse": null
    }
  ]
}

Tables Available for Queries

Note: You recieve back the entire record with the SELECT statement. You cannot define the columns you want back.

SELECT * FROM Company
SELECT * FROM Preferences
SELECT * FROM Account
SELECT * FROM Invoice
SELECT * FROM Customer
SELECT * FROM Vendor
SELECT * FROM Bill
SELECT * FROM BillPayment
SELECT * FROM PaymentMethod
SELECT * FROM Class
SELECT * FROM Deposit
SELECT * FROM CreditMemo
SELECT * FROM JournalEntry
SELECT * FROM Term
SELECT * FROM Item
SELECT * FROM VendorCredit
SELECT * FROM Payment
SELECT * FROM TaxRate

SELECT COUNT(*) FROM Payment WHERE Metadata.CreateTime >= '2020-02-04' AND  TotalAmt !='0'`

SELECT * FROM Payment WHERE Metadata.CreateTime >= '2020-02-04' AND  TotalAmt !='0' STARTPOSITION 1  MAXRESULTS  100