Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here are all the steps I took to get this working. Special thanks to <a href="https://stackoverflow.com/users/26133/keith-palmer">Keith Palmer</a> for his comments, answers, and <a href="http://wiki.consolibyte.com/wiki/doku.php/quickbooks_online_edition" rel="nofollow noreferrer">his website</a> which really helped me get this working.</p> <ol> <li><p><strong>Register your application</strong> at <a href="http://appreg.quickbooks.com" rel="nofollow noreferrer">http://appreg.quickbooks.com</a>. This will give you your App ID and Application Name. I used these settings:</p> <ul> <li>Target Application: QBOE</li> <li>Environment: Production</li> <li><p>Application Type: Desktop</p> <ul> <li>(using Desktop made things much easier as far as not needing certificates)</li> </ul></li> <li><p>A verification key is sent to your email address which you need to enter on page 2 of this wizard.</p></li> </ul></li> <li><strong>Set up your QBOE Connection</strong>. Once you finish registering your application in Step 1, you will then have an Application ID. Use this ID in the url below to set up your QBOE Connection: <ul> <li><a href="https://login.quickbooks.com/j/qbn/sdkapp/confirm?serviceid=2004&amp;appid=APP_ID" rel="nofollow noreferrer">https://login.quickbooks.com/j/qbn/sdkapp/confirm?serviceid=2004&amp;appid=<strong><em><code>APP_ID</code></em></strong></a> </li> <li>NOTE: Make sure to replace APP_ID in the above url with the Application ID that was created when you registered your application.</li> <li>The wizard will take you through the following steps: <ol> <li>Specifying a name for your connection.</li> <li>Granting Access Rights - I gave All Accounting rights since this was easiest.</li> <li>Specify Login Security - I turned Login Security Off. This is important since it makes submitting the xml to the QBOE much easier since you do not need to get a session ticket for each user.</li> <li>You will then be given a Connection Key.</li> </ol></li> </ul></li> <li>At this point you now have the <strong>3 important pieces of information</strong> in order to gain access to your QuickBooks Online Edition (QBOE) account. <ul> <li>Application Name</li> <li>Application ID</li> <li>Connection Key</li> </ul></li> <li><p><strong>Post the XML to QBOE</strong> with the 3 pieces of access information and the actual request into your QBOE database. Here is sample c# code that will post to the QBOE gateway. This will return all customers in your QuickBooks database. Make sure to update the xml below with your Application Name, Application ID, and Connection Key.</p> <pre><code>string requestUrl = null; requestUrl = "https://apps.quickbooks.com/j/AppGateway"; HttpWebRequest WebRequestObject = null; StreamReader sr = null; HttpWebResponse WebResponseObject = null; StreamWriter swr = null; try { WebRequestObject = (HttpWebRequest)WebRequest.Create(requestUrl); WebRequestObject.Method = "POST"; WebRequestObject.ContentType = "application/x-qbxml"; WebRequestObject.AllowAutoRedirect = false; string post = @"&lt;?xml version=""1.0"" encoding=""utf-8"" ?&gt; &lt;?qbxml version=""6.0""?&gt; &lt;QBXML&gt; &lt;SignonMsgsRq&gt; &lt;SignonDesktopRq&gt; &lt;ClientDateTime&gt;%%CLIENT_DATE_TIME%%&lt;/ClientDateTime&gt; &lt;ApplicationLogin&gt;APPLICATION_LOGIN&lt;/ApplicationLogin&gt; &lt;ConnectionTicket&gt;CONNECTION_TICKET&lt;/ConnectionTicket&gt; &lt;Language&gt;English&lt;/Language&gt; &lt;AppID&gt;APP_ID&lt;/AppID&gt; &lt;AppVer&gt;1&lt;/AppVer&gt; &lt;/SignonDesktopRq&gt; &lt;/SignonMsgsRq&gt; &lt;QBXMLMsgsRq onError=""continueOnError""&gt; &lt;CustomerQueryRq requestID=""2"" /&gt; &lt;/QBXMLMsgsRq&gt; &lt;/QBXML&gt;"; post = post.Replace("%%CLIENT_DATE_TIME%%", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss")); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(post); post = xmlDoc.InnerXml; WebRequestObject.ContentLength = post.Length; swr = new StreamWriter(WebRequestObject.GetRequestStream()); swr.Write(post); swr.Close(); WebResponseObject = (HttpWebResponse)WebRequestObject.GetResponse(); sr = new StreamReader(WebResponseObject.GetResponseStream()); string Results = sr.ReadToEnd(); } finally { try { sr.Close(); } catch { } try { WebResponseObject.Close(); WebRequestObject.Abort(); } catch { } } </code></pre></li> <li><p>Couple things to note:</p> <ul> <li>As pointed out by Keith Palmer the qbxml version needs to be 6.0 (even though the IDN Unified On-Screen Reference shows 7.0)</li> <li>I needed to include the onError="continueOnError" attribute.</li> <li>Setting the WebRequestObject.ContentLength property is required.</li> <li>Content Type needs to be "application/x-qbxml"</li> <li>And finally I received many "The remote server returned an error: (400) Bad Request." exceptions which were not helpful at all but in the end I was able to trace them to something wrong with the xml. So if you get this exception look to your xml as the source of the problem.</li> </ul></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload