Insomnia Setup
Insomina is the recommended tool to work with GraphQL. You can start with the free version and upgrade to the paid version as your needs grow. The free version provides all the basic features listed below (or upgrade to the paid version for stronger collaboration):
- Save and run queries
- Browse schema
- Import/Export queries for sharing
- Integrate with oAuth2
Setup
Prerequisites
- You have created an app in developer.intuit.com and worked with your partner in Intuit for access to GraphQL APIs
- This tutorial assumes you are working with a production trial company.
Install Insomnia
Download the latest version. Version 2020.5.2 or higher.
Setup Environment
Launch Insomnina and configure the following environment definition. This step will setup the URLs to access the APIs and Auth. You will need your application’s clientId and clientSecret from the developer portal to complete this step. Select the “Manage environments” option to setup this config.
{
"AccesTokenUrl": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
"Authurl": "https://appcenter.intuit.com/connect/oauth2",
"ClientId": "clientId", <---YOUR APP's ClIENTID
"ClientSecret": "clientSecret", <--YOUR APP's CLIENTSECRET
"RedirectUrl": "https://insomnia.rest",
"url": "https://public.api.intuit.com/2020-04/graphql"
}
Create first query
- Launch Insomnia
- Add new request from the left panel
- Use POST method and select the url environment variable as value
- Select “GraphQL Query” as query type for first tab.
- Paste following query to retrieve details of the company you are connected to
query company { company { id legalName industryType } }
- Setup Auth. Select OAuth2 tab and setup following configuration. Values refer to names from environment variables setup above.
GRANT TYPE : "Authorization Code" AUTHORIZATION URL : Authurl Access Token URL : AccessTokenUrl CLIENT ID : ClientId CLIENT SECRET : ClientSecret Redirect URL : RedirectUrl Enabled : <Checked>
After you complete this task the setup will look like this
You are now ready to run the query.
Send first query
- Click “Send” button to run the query. On the first time, you will see these additional prompts
- Insomnia will ask you to login to your QBO company (enter trial company credentials)
- After a successful login, you will be directed to the connection screen, follow the prompt to establish a connection. You are in the process of establishing a connection between your app and a trial QBO connection.
- After successful connection, you will see tokens in the oAuth2 tab of your request in Insomnia
Congratulations!