restquickbooksquickbooks-online

How to get QuickBooks Company ID with REST API?


I am integrating QuickBooks service in my application. I am using REST APIs for integration.

I am seeing every call is dependent on "Company ID". I want to get that in Oauth object while authenticating or with the help of any REST call. I don't want to force the user to enter "Company ID" in every REST call from the user interface, I want to do it internally by codebase.

Alternatively, is there another way to get it?

https://developer.intuit.com/docs/api/accounting


Solution

  • The OAuth process passes you this data as a GET parameter on the query string.

    So, when your end-user goes through the OAuth process, when they are bounced back to your OAuth URL with the OAuth access token, a query string parameter will be appended:

    ?realmId=(their company ID here)&dataSource=QBO

    Store the company ID when you get that data back from OAuth.