Lucee ColdFusion Quickbooks Desktop Intergration Using QBXML
Lucee ColdFusion Quickbooks Desktop Intergration Using QBXML
Step 1. Download and Install the QuickBooks SDK
Step 2. Download and Install the Free CDATA RemoteConnector for Quickbooks which can be found at http://remoteconnector.com/ (We will be using qbxml so no need for the Cdata Drivers & Adapters)
Follow the set up instruction for both the SDK and the RemoteConnector and give it access to your Quickbooks Company File.
Step 3. Connect to Quickbooks Desktop and make a query as follows:
a. Generate Base64 credentials
<cfset data64 = toBase64('USERNAME:PASSWORD')>
b. Create XML String (Here we are calling info for 100 customers)
<cfset comXML = '<?xml version="1.0" ?><?qbxml version="13.0"?><QBXML><QBXMLMsgsRq onError="stopOnError"><CustomerQueryRq iterator="Start"><MaxReturned>100</MaxReturned><ActiveStatus>All</ActiveStatus><OwnerID>0</OwnerID></CustomerQueryRq></QBXMLMsgsRq></QBXML>'>
c. Use CFHTTP to call the remoteconnector
<cfhttp useragent="Wiredwizard Data Provider Engine – www.wiredwizard.net- Accepts: gzip" method="POST" charset="utf-8" url="http://localhost:8166/">
<cfhttpparam name="X-AcctSyncInteractionType" type="header" value="0">
<cfhttpparam type="header" name="Authorization" value="Basic #data64#">
<cfhttpparam type="header" name="Accept-Encoding" value="gzip, deflate">
<cfhttpparam type="xml" name="Request" value="#arguments.mXML#">
</cfhttp>
d. cfhttp.filecontent will give you your returned xml from there you can use XMLParse to set it into an array.
<cfset myxml=XmlParse(cfhttp.filecontent)>
Some qbxml references for various calls can be found at following links:
QBXml Reference: https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
On GitHub: https://github.com/IntuitDeveloper/QBXML_SDK13_Samples/tree/master/xmlfiles
Consolibyte : http://www.consolibyte.com/docs/index.php/Example_qbXML_Requests