.Net SDK for QuickBooks REST API v3 services
IDG .NET SDK for QuickBooks V3 (Class lib Project written in .NET Standard 2.0- Supports .Net Full Framework 4.6.1, 4.7.2 and .Net Core 2.1,.Net Core 2.2)
Support:
Documentation:
License:
Binaries:
Binaries for OAuth2 only:
The QuickBooks Online .NET SDK provides a set of .NET class libraries that make it easier to call QuickBooks Online APIs, and access to QuickBooks Online data. It supports .Net Core 2.1, .Net Core 2.2, .Net Full Framework 4.6.1 and 4.7.2. Some of the features included in this SDK are:
Note: ->Oauth1 support has been removed from this SDK. Intuit.Ipp.Retry logic now have been moved to Intuit.Ipp.Core. So, if you see Retry not found issues while updating your code, just remove that Using Intuit.Ipp.Retry statement and add Using Intuit.Ipp.Core if not already present.
Understanding the .Net SDK code structure:
Schema
The code has been divided into following main categories-
Data projects
Intuit.Ipp.XsdExtension - This is an external tool whose executable is used to generate the different classes based on the input QBO V3 service schema.
Intuit.Ipp.Data - This project has the updated classes in CDMEntities folder generated by the XsdExtension tool based on new releases of schema.
Core and Common functionality projects
Intuit.Ipp.Core - This project does the job of handling the core functionalities like handling configuration, handling sync, async requests, callbacks and retry logic.
Intuit.Ipp.QueryFilter - Handles all query operations related logic.
Intuit.Ipp.Utility - Handles serialization, deserialization logic, compression, and other config based logic for the API calls.
Intuit.Ipp.Diagnostics - Handles the old Trace Logger code.
Intuit.Ipp.Exception - Handles the exception logic for the different services calls.
Service projects
Intuit.Ipp.DataService - Handles all the Namelist and Transaction entities related operations for sync, async modes and batch mode.
Intuit.Ipp.EntitlementService- Handles Entitlement API related operations. It supports XML request -response format only.
Intuit.Ipp.GlobalTaxService - Handles the custom tax creation related operations. It supports JSON API request- response format only.
Intuit.Ipp.ReportService - Handles all the Reports endpoints related operations
Intuit.Ipp.WebHooksService - Handles the Webhooks related logic.
Security/Auth related projects
Intuit.Ipp.OAuth2PlatformClient - Handles OAuth2 related API calls
Intuit.Ipp.Security - Generates the Authorization header for the API calls
Test Projects
Nuget Package Creation Project
Understanding some important exceptions thrown by the SDK
Logs help you in easliy identifying detailed issues with your payload, get more info in the exception details for fixing them.
New logging support was added to the SDK which includes support for reporting headers and multiple logging sinks available from Serilog. You can chooise to have either one or more of these logging sinks enabled. - Serilogger logs can be enabled for OAuth2PlatformClient using the following lines -
static OAuth2Client oauthClient = new OAuth2Client(clientID, clientSecret, redirectURI, appEnvironment);
//Use this line to enable only intuit-tid based logs, no tokens/response will be logged.
//If set to false, all detailed logs will be available for response
//If set to true, only intuit-tid response headers will be available
// This will work with both custom logger or already supported serilog logger sinks in the SDK
oauthClient.EnableAdvancedLoggerInfoMode = true;
// Option for devs to use this for setting their own custom logger
//Adding support for custom logger where value can be an instance of Serilog.Core.ILogger
oauthClient.CustomLogger = <ILogger custom logger>;
//Already supported logger in the SDK. Either use custom logger or the below statements for serilog logs to work.
oauthClient.EnableSerilogRequestResponseLoggingForConsole = true;
oauthClient.EnableSerilogRequestResponseLoggingForDebug = true;
oauthClient.EnableSerilogRequestResponseLoggingForFile = true;
oauthClient.EnableSerilogRequestResponseLoggingForTrace = true;
oauthClient.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log";//Any drive logging location
Serilogger logs can be enabled for QBO API calls using the following lines -
ServiceContext context = new ServiceContext(dictionary["realmId"], IntuitServicesType.QBO, oauthValidator);
//Adding support for custom logger where value can be an instance of Serilog.Core.ILogger
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.CustomLogger = <ILogger custom logger>;
//Already supported logger in the SDK. Either use custom logger or the below statements for serilog logs to work.
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForFile = true;
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForConsole = true;
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForTrace = true;
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForDebug = true;
context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log"; //Any drive logging location
Old file based logs can be enabled by using the following lines-
context.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true;
context.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\Documents\Serilog_log"; //Any drive logging location
Download Fiddler from Google and run it alongside your code to log raw requests and responses along with URL and headers. When you download Fiddler, open it, go to Tools > Fiddler Option > Enable (Tick Mark) Capture HTTPS connects > Enable Decrypt Https traffic. That’s it. No other setting is required. The .NET localhost is by default captured in Fiddler, so after you have enabled https traffic in Fiddler just run your code. (Fiddler should be open.) You will see requests and responses logged in Fiddler. You should set 'decode the raw request body' by clicking on the yellow bar in Fiddler. Then go to the File menu on top, select Save all session > Save the fiddler session. A .saz file is created, which can be viewed later.
Refer to the following steps to generate all the keys required to run tests using OAuth Playground-
Go to Developer Docs.
Create an app on our IDG platform for the QuickBooks Online v3 APIs.
For OAuth2 apps, you will get a set of Development keys, including client key and client secret. This can be used to get OAuth access token and refresh token for sandbox companies.
To get Prod app keys to get OAuth tokens for live companies: Go to your app->Settings tab-> enter all URLs and save. Then get the prod keys from Keys tab under Prod section.
To get OAuth access tokens, go to your app's dashboard, Click Oauth Playground
NOTE: For sandbox testing, you need to use dev app keys and sandbox base URL. For live/prod QuickBooks company testing, use prod app keys and prod base URL after doing a private publish as mentioned below. Go to your app->Prod tab-> enter all URLs and save. Then get the prod keys from Keys tab under Prod tab of the app.
We greatly encourage contributions! You can add new features, report and fix existing bugs, write docs and tutorials, or any of the above. Feel free to open issues and/or send pull requests.
The master
branch of this repository contains the latest release of the SDK, while snapshots are published to the develop
branch. In general, pull requests should be submitted against develop
by forking this repo into your account, developing and testing your changes, and creating pull requests to request merges. See the Contributing to a Project
article for more details about how to contribute.
Steps to contribute:
git clone https://github.com/YOURUSERNAME/QuickBooks-V3-DotNET-SDK.git
Note: Before you submit the pull request, make sure to remove the keys and tokens from appsettings.json
Thank you for your contribution!
Samples: https://github.com/intuitdeveloper