Hey Devs,
At Intuit, we’re constantly improving our products including the QuickBooks Online API. This means we need to be able to introduce incremental changes to the API without breaking your app. Minor versions provides a way to do just that. Now, let’s look at how it works, so you can take advantage of new features today!
Working with Minor Versions
- A given minor version is associated with a specific API XSD; make sure you have downloaded the latest XSD.
- Use the minorversion query parameter in QuickBooks Online API requests to access a minor version of the API other than the generally available version. For example, to invoke minor version 10 on the Customer resource, issue the following request. https://quickbooks.api.intuit.com/v3/company/<realmID>/customer/entityId?minorversion=10.
- If no minor version is specified, API requests access the base version.
- Minor version changes can be accessed on a per-resource basis. There is no need to apply the same minor version to all API calls unless you wish to do so.
Using the SDK with minor versions
- A given SDK version automatically accesses the features of a specific minor version and all prior versions.
- Once a newer version of an SDK is released, you need to update your code if your want to take advantage of new features and new minor version support. Apps using older versions of the SDK will continue to run, however.
- Consult the release notes for the individual SDK for current minor version support: .NET SDK release notes, Java SDK release notes, PHP SDK release notes.
How to test using Postman
Download the QuickBooks Accounting API Postman Collection and go to the environment variables to enter in the desired minor version. For more information about the QuickBooks Accounting API Postman Collection, go here.
SDK Support
[tabby title=”JAVA”]
To override the default minor version:
First, build the service context.
For an app to access QuickBooks data, the user must authorize the app. In this type of authorization, an OAuth token is used to authorize and connect an app to the company. This page describes how to use Intuit OAuth 2.0 endpoints to authorize your app’s access to your user’s QuickBooks company data when developing with the Java SDK.
For detailed information on the authorization process using OAuth 2.0, see Implement OAuth 2.0. For reference information on the OAuth 2.0 methods, see the OAuth2PlatformClient class in Java Class Library Reference. See the Java OAuth 2.0 sample app for a working example of how to implement OAuth 2.0 using the Java SDK.
Then, override the minor version as follows:
Context context = new Context(oauth, appToken, ServiceType.QBO, realmID);
context.setMinorVersion("6");
[tabby title=”.NET”]
Use the steps in this section to override the default value or, if set, the value defined in the configuration file.
The following code snippet shows how to create an instance of the ServiceContext class using OAuthRequestValidator object:
- Create the OAuthRequestValidator object
string accessToken = ...
string accessTokenSecret = ...
string consumerKey = ...
string consumerSecret = ...
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
- accessToken: Acquired by your app during the OAuth flow when the user connects to their QuickBooks company from your app.
- accessTokenSecret: Also acquired by your app during the OAuth flow when the user connects to their QuickBooks company from your app.
- consumerKey: Assigned to your app by Intuit and displayed as OAuth Consumer Key in the app profile on the Intuit Developer site.
- consumerSecret: Assigned to your app by Intuit and displayed as OAuth Consumer Secret in the app profile on the Intuit Developer site.
- Create an Instance of the ServiceContext class
Now, build the ServiceContext object for QuickBooks API apps:
ServiceContext context = new ServiceContext (appToken, realmID, IntuitServicesType.QBO, oauthValidator);
//or
ServiceContext context = new ServiceContext (companyID, IntuitServicesType.QBO, oauthValidator);
- appToken: Assigned to your app by Intuit and displayed in the app profile as App Token on the Intuit Developer site.
- realmID: The Id of user’s QuickBooks Online company. This Id, sometimes referred to as a companyID, is returned with the OAuth access token when the user connects to their QuickBooks company from your app.
- oauthValidator: An OAuthRequestValidator object instance created in the previous step.
Final step is to override the request and response formats, as follows:
serviceContext.IppConfiguration.MinorVersion.Qbo = "5";
[tabby title=”PHP”]
Use the steps in this section to override the default value or, if set, the value defined in the configuration file.
Then, override the request and response formats, as follows:$serviceContext->setMinorVersion = "5";
[tabbyending]
As you can see, using minor versions is the best way to get the latest features of the QuickBooks Online API!
Happy Coding!
Jimmy Wong
Intuit Developer Evangelist
Leave a Reply