Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Xojo Plugin Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Xojo Plugin) Quickbooks Query an Invoice

Demonstrates how to query for invoices matching a SELECT statement via the Quickbooks REST API.

For more information, see https://www.developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/invoice#query-an-invoice

Chilkat Xojo Plugin Download

Xojo Plugin for Windows, Linux, Mac OS X, and ARM, ARM64

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

// First get our previously obtained OAuth2 access token.
Dim jsonToken As New Chilkat.JsonObject
Dim success As Boolean
success = jsonToken.LoadFile("qa_data/tokens/qb-access-token.json")

Dim rest As New Chilkat.Rest

Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
Dim success As Boolean
success = rest.Connect("sandbox-quickbooks.api.intuit.com",port,bTls,bAutoReconnect)

Dim sbAuth As New Chilkat.StringBuilder
success = sbAuth.Append("Bearer ")
success = sbAuth.Append(jsonToken.StringOf("access_token"))
rest.Authorization = sbAuth.GetAsString()

// --------------------------------------------------------------------------
// Note: The above REST connection and setup of the AWS credentials
// can be done once.  After connecting, any number of REST calls can be made.
// The "auto reconnect" property passed to rest.Connect indicates that if
// the connection is lost, a REST method call will automatically reconnect
// if needed.
// --------------------------------------------------------------------------

// This is a GET request, so there should be no Content-Type
// This line of code is just to make sure..
success = rest.RemoveHeader("Content-Type")

success = rest.AddHeader("Accept","application/json")
rest.AllowHeaderFolding = False

// Add a SELECT statement 
success = rest.AddQueryParam("query","select * from Invoice where id = '239'")

Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/v3/company/<realmID>/invoice",sbResponseBody)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    System.DebugLog("Response Status Code = " + Str(respStatusCode))
    System.DebugLog("Response Header:")
    System.DebugLog(rest.ResponseHeader)
    System.DebugLog("Response Body:")
    System.DebugLog(sbResponseBody.GetAsString())
    Return
End If

// Success is indicated by a 200 response status.
System.DebugLog("response status code = " + Str(respStatusCode))

Dim json As New Chilkat.JsonObject
success = json.LoadSb(sbResponseBody)
json.EmitCompact = False
System.DebugLog(json.Emit())

// Sample output:
// Use the this online tool to generate parsing code from sample JSON: 
// Generate Parsing Code from JSON

// {
//   "QueryResponse": {
//     "startPosition": 1, 
//     "totalCount": 1, 
//     "maxResults": 1, 
//     "Invoice": [
//       {
//         "DocNumber": "1070", 
//         "SyncToken": "0", 
//         "domain": "QBO", 
//         "Balance": 150.0, 
//         "BillAddr": {
//           "City": "Bayshore", 
//           "Line1": "4581 Finch St.", 
//           "PostalCode": "94326", 
//           "Lat": "INVALID", 
//           "Long": "INVALID", 
//           "CountrySubDivisionCode": "CA", 
//           "Id": "2"
//         }, 
//         "TxnDate": "2015-07-24", 
//         "TotalAmt": 150.0, 
//         "CustomerRef": {
//           "name": "Amy's Bird Sanctuary", 
//           "value": "1"
//         }, 
//         "ShipAddr": {
//           "City": "Bayshore", 
//           "Line1": "4581 Finch St.", 
//           "PostalCode": "94326", 
//           "Lat": "INVALID", 
//           "Long": "INVALID", 
//           "CountrySubDivisionCode": "CA", 
//           "Id": "109"
//         }, 
//         "LinkedTxn": [], 
//         "DueDate": "2015-08-23", 
//         "PrintStatus": "NeedToPrint", 
//         "Deposit": 0, 
//         "sparse": false, 
//         "EmailStatus": "NotSet", 
//         "Line": [
//           {
//             "LineNum": 1, 
//             "Amount": 150.0, 
//             "SalesItemLineDetail": {
//               "TaxCodeRef": {
//                 "value": "NON"
//               }, 
//               "ItemRef": {
//                 "name": "Services", 
//                 "value": "1"
//               }
//             }, 
//             "Id": "1", 
//             "DetailType": "SalesItemLineDetail"
//           }, 
//           {
//             "DetailType": "SubTotalLineDetail", 
//             "Amount": 150.0, 
//             "SubTotalLineDetail": {}
//           }
//         ], 
//         "ApplyTaxAfterDiscount": false, 
//         "CustomField": [
//           {
//             "DefinitionId": "1", 
//             "Type": "StringType", 
//             "Name": "Crew #"
//           }
//         ], 
//         "Id": "239", 
//         "TxnTaxDetail": {
//           "TotalTax": 0
//         }, 
//         "MetaData": {
//           "CreateTime": "2015-07-24T10:35:08-07:00", 
//           "LastUpdatedTime": "2015-07-24T10:35:08-07:00"
//         }
//       }
//     ]
//   }, 
//   "time": "2015-07-24T10:38:50.01-07:00"
// }

Dim DocNumber As String
Dim SyncToken As String
Dim domain As String
Dim Balance As String
Dim BillAddrCity As String
Dim BillAddrLine1 As String
Dim BillAddrPostalCode As String
Dim BillAddrLat As String
Dim BillAddrLong As String
Dim BillAddrCountrySubDivisionCode As String
Dim BillAddrId As String
Dim TxnDate As String
Dim TotalAmt As String
Dim CustomerRefName As String
Dim CustomerRefValue As String
Dim ShipAddrCity As String
Dim ShipAddrLine1 As String
Dim ShipAddrPostalCode As String
Dim ShipAddrLat As String
Dim ShipAddrLong As String
Dim ShipAddrCountrySubDivisionCode As String
Dim ShipAddrId As String
Dim DueDate As String
Dim PrintStatus As String
Dim Deposit As Int32
Dim sparse As Boolean
Dim EmailStatus As String
Dim ApplyTaxAfterDiscount As Boolean
Dim Id As String
Dim TxnTaxDetailTotalTax As Int32
Dim MetaDataCreateTime As String
Dim MetaDataLastUpdatedTime As String
Dim j As Int32
Dim count_j As Int32
Dim LineNum As Int32
Dim Amount As String
Dim SalesItemLineDetailTaxCodeRefValue As String
Dim SalesItemLineDetailItemRefName As String
Dim SalesItemLineDetailItemRefValue As String
Dim DetailType As String
Dim DefinitionId As String
Dim invType As String
Dim Name As String

Dim QueryResponseStartPosition As Int32
QueryResponseStartPosition = json.IntOf("QueryResponse.startPosition")
Dim QueryResponseTotalCount As Int32
QueryResponseTotalCount = json.IntOf("QueryResponse.totalCount")
Dim QueryResponseMaxResults As Int32
QueryResponseMaxResults = json.IntOf("QueryResponse.maxResults")
Dim time As String
time = json.StringOf("time")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = json.SizeOfArray("QueryResponse.Invoice")
While i < count_i
    json.I = i
    DocNumber = json.StringOf("QueryResponse.Invoice[i].DocNumber")
    SyncToken = json.StringOf("QueryResponse.Invoice[i].SyncToken")
    domain = json.StringOf("QueryResponse.Invoice[i].domain")
    Balance = json.StringOf("QueryResponse.Invoice[i].Balance")
    BillAddrCity = json.StringOf("QueryResponse.Invoice[i].BillAddr.City")
    BillAddrLine1 = json.StringOf("QueryResponse.Invoice[i].BillAddr.Line1")
    BillAddrPostalCode = json.StringOf("QueryResponse.Invoice[i].BillAddr.PostalCode")
    BillAddrLat = json.StringOf("QueryResponse.Invoice[i].BillAddr.Lat")
    BillAddrLong = json.StringOf("QueryResponse.Invoice[i].BillAddr.Long")
    BillAddrCountrySubDivisionCode = json.StringOf("QueryResponse.Invoice[i].BillAddr.CountrySubDivisionCode")
    BillAddrId = json.StringOf("QueryResponse.Invoice[i].BillAddr.Id")
    TxnDate = json.StringOf("QueryResponse.Invoice[i].TxnDate")
    TotalAmt = json.StringOf("QueryResponse.Invoice[i].TotalAmt")
    CustomerRefName = json.StringOf("QueryResponse.Invoice[i].CustomerRef.name")
    CustomerRefValue = json.StringOf("QueryResponse.Invoice[i].CustomerRef.value")
    ShipAddrCity = json.StringOf("QueryResponse.Invoice[i].ShipAddr.City")
    ShipAddrLine1 = json.StringOf("QueryResponse.Invoice[i].ShipAddr.Line1")
    ShipAddrPostalCode = json.StringOf("QueryResponse.Invoice[i].ShipAddr.PostalCode")
    ShipAddrLat = json.StringOf("QueryResponse.Invoice[i].ShipAddr.Lat")
    ShipAddrLong = json.StringOf("QueryResponse.Invoice[i].ShipAddr.Long")
    ShipAddrCountrySubDivisionCode = json.StringOf("QueryResponse.Invoice[i].ShipAddr.CountrySubDivisionCode")
    ShipAddrId = json.StringOf("QueryResponse.Invoice[i].ShipAddr.Id")
    DueDate = json.StringOf("QueryResponse.Invoice[i].DueDate")
    PrintStatus = json.StringOf("QueryResponse.Invoice[i].PrintStatus")
    Deposit = json.IntOf("QueryResponse.Invoice[i].Deposit")
    sparse = json.BoolOf("QueryResponse.Invoice[i].sparse")
    EmailStatus = json.StringOf("QueryResponse.Invoice[i].EmailStatus")
    ApplyTaxAfterDiscount = json.BoolOf("QueryResponse.Invoice[i].ApplyTaxAfterDiscount")
    Id = json.StringOf("QueryResponse.Invoice[i].Id")
    TxnTaxDetailTotalTax = json.IntOf("QueryResponse.Invoice[i].TxnTaxDetail.TotalTax")
    MetaDataCreateTime = json.StringOf("QueryResponse.Invoice[i].MetaData.CreateTime")
    MetaDataLastUpdatedTime = json.StringOf("QueryResponse.Invoice[i].MetaData.LastUpdatedTime")
    j = 0
    count_j = json.SizeOfArray("QueryResponse.Invoice[i].LinkedTxn")
    While j < count_j
        json.J = j
        j = j + 1
    Wend
    j = 0
    count_j = json.SizeOfArray("QueryResponse.Invoice[i].Line")
    While j < count_j
        json.J = j
        LineNum = json.IntOf("QueryResponse.Invoice[i].Line[j].LineNum")
        Amount = json.StringOf("QueryResponse.Invoice[i].Line[j].Amount")
        SalesItemLineDetailTaxCodeRefValue = json.StringOf("QueryResponse.Invoice[i].Line[j].SalesItemLineDetail.TaxCodeRef.value")
        SalesItemLineDetailItemRefName = json.StringOf("QueryResponse.Invoice[i].Line[j].SalesItemLineDetail.ItemRef.name")
        SalesItemLineDetailItemRefValue = json.StringOf("QueryResponse.Invoice[i].Line[j].SalesItemLineDetail.ItemRef.value")
        Id = json.StringOf("QueryResponse.Invoice[i].Line[j].Id")
        DetailType = json.StringOf("QueryResponse.Invoice[i].Line[j].DetailType")
        j = j + 1
    Wend
    j = 0
    count_j = json.SizeOfArray("QueryResponse.Invoice[i].CustomField")
    While j < count_j
        json.J = j
        DefinitionId = json.StringOf("QueryResponse.Invoice[i].CustomField[j].DefinitionId")
        invType = json.StringOf("QueryResponse.Invoice[i].CustomField[j].Type")
        Name = json.StringOf("QueryResponse.Invoice[i].CustomField[j].Name")
        j = j + 1
    Wend
    i = i + 1
Wend

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.