quickbooksquickbooks-onlineintuit-partner-platform

Account Query. Where does the query go? GET /v3/company/<clientID>/query?query=<selectStatement>&minorversion=59 Does it go in the <selectStatement>?


I am using QuickBooks Online API.

Documentation for the Account Object is here: https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account

Sample Request URL:

GET /v3/company/<clientID>/query?query=<selectStatement>&minorversion=59

Content type:text/plain
Production Base URL:https://quickbooks.api.intuit.com
Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com

Sample Query:

select * from Account where Metadata.CreateTime > '2014-12-31'

Sample Return:

{
  "QueryResponse": {
    "startPosition": 1, 
    "Account": [
      {
        "FullyQualifiedName": "Canadian Accounts Receivable", 
        "domain": "QBO", 
        "Name": "Canadian Accounts Receivable", 
        "Classification": "Asset", 
        "AccountSubType": "AccountsReceivable", 
        "CurrencyRef": {
          "name": "United States Dollar", 
          "value": "USD"
        }, 
        "CurrentBalanceWithSubAccounts": 0, 
        "sparse": false, 
        "MetaData": {
          "CreateTime": "2015-06-23T09:38:18-07:00", 
          "LastUpdatedTime": "2015-06-23T09:38:18-07:00"
        }, 
        "AccountType": "Accounts Receivable", 
        "CurrentBalance": 0, 
        "Active": true, 
        "SyncToken": "0", 
        "Id": "92", 
        "SubAccount": false
      }, 
      {
        "FullyQualifiedName": "MyClients", 
        "domain": "QBO", 
        "Name": "MyClients", 
        "Classification": "Asset", 
        "AccountSubType": "AccountsReceivable", 
        "CurrencyRef": {
          "name": "United States Dollar", 
          "value": "USD"
        }, 
        "CurrentBalanceWithSubAccounts": 0, 
        "sparse": false, 
        "MetaData": {
          "CreateTime": "2015-07-13T12:34:47-07:00", 
          "LastUpdatedTime": "2015-07-13T12:34:47-07:00"
        }, 
        "AccountType": "Accounts Receivable", 
        "CurrentBalance": 0, 
        "Active": true, 
        "SyncToken": "0", 
        "Id": "93", 
        "SubAccount": false
      }, 
      {
        "FullyQualifiedName": "MyJobs", 
        "domain": "QBO", 
        "Name": "MyJobs", 
        "Classification": "Asset", 
        "AccountSubType": "AccountsReceivable", 
        "CurrencyRef": {
          "name": "United States Dollar", 
          "value": "USD"
        }, 
        "CurrentBalanceWithSubAccounts": 0, 
        "sparse": false, 
        "MetaData": {
          "CreateTime": "2015-01-13T10:29:27-08:00", 
          "LastUpdatedTime": "2015-01-13T10:29:27-08:00"
        }, 
        "AccountType": "Accounts Receivable", 
        "CurrentBalance": 0, 
        "Active": true, 
        "SyncToken": "0", 
        "Id": "91", 
        "SubAccount": false
      }
    ], 
    "maxResults": 3
  }, 
  "time": "2015-07-13T12:35:57.651-07:00"
}

In the Sample Request URL, I need to determine what to type into the "selectStatement".

I have found additional documentation here:
https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries


Solution

  • You have an example of what to put for selectStatement in your post:

    select * from Account where Metadata.CreateTime > '2014-12-31'
    

    e.g.:

    /v3/company/<clientID>/query?query=select * from Account where Metadata.CreateTime > '2014-12-31'&minorversion=59