将 ASP.NET 应用程序连接到 QuickBooks Online Edition
我正在尝试创建一个连接到 QuickBooks Online Edition 的 ASP.NET 页面,读取几个值并显示结果。 到目前为止,我已经下载了 QuickBooks SDK,但我无法找到有关如何创建 asp.net 页面以连接到 QuickBooks Online 的简单分步示例。 QuickBooks SDK 文档和 SDK 本身非常令人困惑和不知所措。 任何人都知道关于从哪里开始的简单分步教程......或者可能是关于要做的第一件事的提示。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Yishai 的回答部分正确,但不完全正确。
如果您确保设置,您可以让您的 ASP .NET 应用程序登录并发出请求而无需将用户发送到 QuickBooks Online 登录页面当您将应用程序连接到 QuickBooks Online Edition 时,请正确设置安全首选项。
在应用程序注册过程/连接过程中,它会询问您是否要打开或关闭登录安全性,提示如下。 如果您希望能够访问 QuickBooks Online Edition 数据而不每次都强制用户登录,则必须告诉它您想要关闭登录安全性。 提示类似于:
“您要打开登录安全性吗?”
您必须选择:
“不。任何可以登录[应用程序名称]的人都可以使用该连接”。
除此之外,Yishai 对整个过程的看法是正确的。 重申一下,简而言之:
我的 QuickBooks 开发和集成 wiki 上有一些附加文档和一些示例请求,特别是 QuickBooks Online Edition 集成 页面。
我已经构建了一个解决方案,可以执行您在 PHP 中要求的操作,该解决方案可以在 QuickBooks Online Edition 中添加、修改和查询数据,而无需用户每次都登录,并且它的工作方式非常出色。 它在 PHP 购物车 (VirtueMart) 和 QuickBooks Online Edition 之间推送和拉取订单数据。 PHP 代码可在此处获取:
QuickBooks PHP 框架
作为旁注,除非您如果您非常熟悉生成 SSL 证书并通过 HTTPS POST 发送证书,那么通过使用 DESKTOP 通信模型(而不是 HOSTED 模型)可以为自己省去很多麻烦。 只需确保您的连接票证安全加密即可。
此外,Yishai 的建议是:“一种是以编程方式打开他们的登录页面并提交凭据,就像您是用户一样。我确信它不“受支持”,但它可能会起作用。” 特别违反 Intuit 和 SDK 规定的安全/开发人员指南。 如果他们发现您这样做,他们将禁止您的应用程序连接到 QuickBooks。
Yishai's answer is partially correct, but not entirely.
You can have your ASP .NET application log in and issue requests without having to send the user over to the QuickBooks Online log in page if you make sure to set the security preferences correctly when you connect up your application to QuickBooks Online Edition.
During the application registration process/connection process, it will ask you if you want to turn on or off login security with a prompt as below. You must tell it you want to turn off login security if you want to be able to access QuickBooks Online Edition data without forcing the user to log in every time. The prompt is something like:
"Do you want to turn on login security?"
You must select:
"No. Anyone who can log into [Application Name] can use the connection".
Outside of that, Yishai is correct about the process. To re-iterate, in a nutshell:
There is some additional documentation and some example requests on my QuickBooks development and integration wiki, specifically the QuickBooks Online Edition integration page.
I have built a solution that does what you're asking in PHP which adds, modifies, and queries data within QuickBooks Online Edition without requiring the user to log in everytime, and it works like a champ. It pushes and pulls order data between a PHP shopping cart (VirtueMart) and QuickBooks Online Edition. The PHP code is available here:
QuickBooks PHP Framework
As a side note, unless you're very familiar with generating SSL certificates and sending them via HTTPS POSTs, you'll save yourself a whole lot of trouble by using the DESKTOP model of communication, and not the HOSTED model. Just make sure to keep your connection ticket securely encrypted.
Also, Yishai's suggestion to: "One is to programatically hit up their login page and submit the credentials as if you were a user. I'm sure its not "supported" but it would likely work." goes specifically against the security/developer guidelines Intuit and the SDK set forth. If they catch you doing that, they'll ban your application from connecting to QuickBooks.
以下是我为实现此目的所采取的所有步骤。 特别感谢 Keith Palmer 的评论、回答和 他的网站确实帮助我完成了这项工作。
在 http://appreg.quickbooks.com 上注册您的应用程序。 这将为您提供应用程序 ID 和应用程序名称。 我使用了这些设置:
应用程序类型:桌面
验证密钥将发送到您的电子邮件地址,您需要在此向导的第 2 页上输入该地址。
APP_ID
将 XML 发布到 QBOE,其中包含 3 条访问信息和实际请求到您的 QBOE 数据库中。 以下是将发布到 QBOE 网关的示例 C# 代码。 这将返回 QuickBooks 数据库中的所有客户。 请务必使用您的应用程序名称、应用程序 ID 和连接密钥更新下面的 xml。
需要注意的几点:
Here are all the steps I took to get this working. Special thanks to Keith Palmer for his comments, answers, and his website which really helped me get this working.
Register your application at http://appreg.quickbooks.com. This will give you your App ID and Application Name. I used these settings:
Application Type: Desktop
A verification key is sent to your email address which you need to enter on page 2 of this wizard.
APP_ID
Post the XML to QBOE 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.
Couple things to note:
QBSDK 文档的第 7 章概述了您必须执行的操作(至少在我拥有的 7.0 版本的 SDK 中)。 您必须开设一个测试帐户并获得连接到他们的服务器的权限。
设置帐户后,基本身份验证过程包括将用户重定向到 QuickBooks Online 站点进行登录,用户完成此操作后,QuickBooks 会通过带有票证的 HTTPS 帖子回调您的应用程序,这基本上是一个您可以将其用于请求的会话句柄,以便系统知道您已通过身份验证。 当您收到该响应时,您可以解析它并根据返回的内容将您自己的登录请求发送到系统。
然后(如果我正确理解了文档)您基本上是使用 QuickBooks 请求对 xml 文件进行 Https POST,并且获得 XML 响应,您必须对其进行解析才能获取所需的数据。
我希望这能让你开始。
SDK 的其余部分是文档(您需要知道如何形成请求并解析响应),其他所有内容都与如何与桌面产品通信有关。 您从文档的其余部分中唯一需要的是如何进行错误处理,这实际上仅在您将数据发布到 QuickBooks 时才重要。 如果您只是阅读,那并不重要(无论您的请求成功还是失败,您都无需担心是否需要重试或是否会导致重复数据)。
编辑:鉴于您的具体用例,我看到两个选项。 (你并没有疯,只是不是典型的 QuickBooks Online 场景)。
一种是以编程方式打开他们的登录页面并提交凭据,就像您是用户一样。 我确信它不“受支持”,但它可能会起作用。
另一个是缓存结果(无论如何你都应该这样做)并有一个管理屏幕,有人可以在线登录 QuickBooks 并每天早上或晚上或任何有意义的时间更新结果。
在大多数小型企业中,他们会选择第一个选项,但第二个选项会更一致、更稳健,并且如果您遇到问题,实际上会得到 Intuit 的支持。
The outline of what you have to do are outlined in Chapter 7 of the QBSDK documentation (at least in the 7.0 version of the SDK that I have). You have to open a test account and get permission to connect to their servers.
Once you have your account setup, the basic authentication procedure consists of redirecting your user to the QuickBooks Online site to log in, and once the user has done that, QuickBooks calls back your application with an HTTPS post with a ticket, which is basically a session handle that you can use for your requests, so that the system knows you are authenticated. When you get that response, you parse it and send your own login request to the system based on what you got back.
Then (if I understood the documentation correctly) you are basically doing Https POSTS of xml files with the QuickBooks requests, and you get XML responses that you have to parse to get the data you want.
I hope that gets you started.
The rest of the SDK is documentation (which you will need to know how to form your requests and parse your responses) and everything else is concerned with how to communicate with the desktop product. The only thing you are going to need from the rest of the documentation is how to do error handling, which is really only important if you are posting data to QuickBooks. If you are just reading, it doesn't matter (either your request works out or it doesn't, you don't need to worry about if you need to retry or if that would result in duplicate data).
EDIT: Given your specific use case I see two options. (You aren't crazy, just not the typical QuickBooks Online scenario).
One is to programatically hit up their login page and submit the credentials as if you were a user. I'm sure its not "supported" but it would likely work.
The other is to cache the results (which you should probably do anyway) and have an admin screen where someone does log into QuickBooks online and update the results every morning or evening or whatever makes sense.
In most small businesses, they are going to opt for the first option, but the second one is going to work more consistently, robustly and actually be supported by Intuit if you have an issue.
这看起来非常接近您所需要的: www.QuickbooksConnector.com
无法下载它吧。
This looks pretty close to what you need: www.QuickbooksConnector.com
Wasn't able to download it yet.