Interacting with QuickBooks Online V3 API

…衆ロ難τιáo~ 提交于 2019-12-22 14:08:25

问题


I'm writing a web application (that is not to be published by Intuit on their App Center thing) to interact with QuickBooks Online (QBO) for syncing purposes, using VB.NET and ASP.NET. I'm having a hard time understanding how to do this exactly or where to start. What I understand this this:

  1. User accesses your web application and the "Connect to QuickBooks" button (that Intuit requires for In-App authorization) is displayed.
  2. Before the button is clicked you send a HTTP request to get OAuth request credentials using your consumer credentials.
  3. Once the user clicks the button they get redirected to QuickBooks Online (QBO) where they can sign in and then authorize access to a certain company, giving you authorized request credentials.
  4. QBO then redirects back to your site indicating you have authorized request credentials in which you send a HTTP request to get access credentials.
  5. Once you have the access credentials you are basically free to interact with the QBO V3 API.
  6. Using the access credentials you can then construct HTTP requests that send a particular HTTP method with XML/JSON in the body to perform a corresponding CRUD operation in QBO and QBO sends a response to indicate whether it was successful or not.
  7. When your application is done interacting with QBO you simply make sure the access credentials are stored somewhere safe and let the user continue on with their life.

(Side Question: Is this correct or did I miss something or misunderstand something?)

My main question: Do you, as the app developer, even need to construct these HTTP requests or do you use their SDK or something completely different and I'm just not getting it?

I've tried to figure this out but it sounds like you're supposed to construct this all from scratch but then I look in their SDK and they have classes for all the different entity types but then their serializer doesn't serialize correctly and they talk about their DataService class and how you use that to send objects over and using some JavaScript files they host that I have only seen referenced but not explained by them, or anyone really, and information I do find seems to be outdated/deprecated and ya...

Maybe it's just that I'm new to web development and all this is way over my head right now, which very well could be.

(Off-topic-sorta: Is it me or is their site ridiculously broken? It just seems like a lot doesn't work correctly or things are just hard to navigate and find...)

Anyways, thanks for any help anyone can offer. If I need to give more details or ask a different question or something, just let me know. New to this and it's harder than I thought to ask things haha.


回答1:


My main question: Do you, as the app developer, even need to construct these HTTP requests or do you use their SDK or something completely different and I'm just not getting it?

This is entirely up to you, the developer.

If you want to roll your own and construct your own HTTP requests, you certainly can. You almost certainly will still want to use a pre-packaged OAuth library, as OAuth is not trivial to implement.

However, you could also certainly use an existing code library/DevKit too, in which case the library/DevKit will construct the HTTP requests for you.

The DevKits should contain example code to show you how to actually do this stuff, so that might be your best place to start.




回答2:


You are on right track.

First of all you need to register with IPP to get ConsumerKey,ConsumerKey secret and Application ID.

https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0020_connect/0010_from_within_your_app/implement_oauth_in_your_app

if user don't have access token then 'connect to quickbooks' button shows up otherwise you can make it hidden.

request code : https://github.com/IntuitDeveloperRelations/IPP_Sample_Code/blob/master/QuickbooksAPI/DotNet/WebForms%20application/QuickBooksApiDotNetWebFormsSampleApp/OauthGrant.aspx.cs

access code : https://github.com/IntuitDeveloperRelations/IPP_Sample_Code/blob/master/QuickbooksAPI/DotNet/WebForms%20application/QuickBooksApiDotNetWebFormsSampleApp/OauthHandler.aspx.cs

After getting accesstoken, accesskey secret and realmID (companyid) save that to your database. make sure to encrypt.

so next time same user connect to quickbooks they don't need to go through all of the above steps.

OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);

ServiceContext context = new ServiceContext (appToken, companyID, IntuitServicesType.QBO, oauthValidator);

https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/0002_synchronous_calls/0001_data_service_apis



来源:https://stackoverflow.com/questions/21591034/interacting-with-quickbooks-online-v3-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!