Set up and test with Insomnia
You can start with the free version of Insomnia. This gives you basic features that cover most testing requirements. If you need more features, you can always upgrade later on.
Insomnia lets you keep collections of sample GraphQL queries you can use over and over for testing. It also uses OAuth syntax and lets you use variables to update things like access tokens.
Tip: You can also follow the install guide from Insomnia.
Step 1: Set up your app in the Intuit Developer Portal
If you haven’t already, get a QuickBooks Online sandbox company for testing, create your app, and get your sandbox company’s Client ID and Client Secret.
Step 2: Add the Insomnia redirect URI
- Sign in to your developer account.
- Select the Dashboard link on the toolbar.
- Select and open your app.
- In the Development section, select Keys & OAuth.
- In the Redirect URIs section, select Add URI.
- Enter the insomnia redirect URI: https://insomnia.rest.
Step 3: Download and set up Insomnia
- Download the latest version of Insomnia.
- Launch and install Insomnia.
- Select the Manage environments option.
- Paste this configuration into the window:
{
"AccessTokenUrl": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
"Authurl": "https://appcenter.intuit.com/connect/oauth2",
"ClientId": "[Your app's ClientID]",
"ClientSecret": "[Your app's ClientSecret]",
"RedirectUrl": "https://insomnia.rest",
"url": "https://public.api.intuit.com/2020-04/graphql"
}
This configures and connects Insomnia to your app and Intuit Ecosystem API.
Step 4: Start a test query in Insomnia
- Select the (+) icon and then New Request.
- Name the request.
- Select the POST method from the dropdown.
- Select the URL environment variable. You set up the environment in Step 2.
- Select GraphQL query as the query type.
- Select Create.
This opens a query window. Use this basic test query to get company
data for your sandbox test company:
query company {
company {
id
legalName
industryType
}
}
Step 5: Configure authorization variables Insomnia
In the query window, set the OAuth2.0 environment variables:
- Select the OAuth 2.0 tab.
- From the Grant type dropdown, select Authorization code.
- In the Authorization URL field, enter Authurl.
- In the Access Token URL field, enter AccessTokenUrl.
- In the Client ID field, enter ClientId.
- In the Client Secret field, enter ClientSecret.
- In the Redirect URL field, enter RedirectUrl.
- Select the Enabled checkbox.
Step 6: Send the test query
Everything is ready to go. Select Send to send the test query.
The first time you send a query, Insomnia will ask you to sign in to your sandbox QuickBooks Online company. Follow the on-screen steps to connect them.
You’ll see access tokens in the OAuth 2.0 tab. Use these to test code and queries in Insomnia.