From 09df9805f8a0dde79dcdbebaaddc671a939b9190 Mon Sep 17 00:00:00 2001 From: Diana De Rose Date: Sat, 29 Jun 2024 20:33:37 -0700 Subject: [PATCH] remove unused pages --- docs/faq/graphql-vs-rest.md | 159 ------------------ .../graphql-ide/graphql-ide.md | 23 +-- docs/getting-started/graphql-ide/insomnia.md | 81 --------- 3 files changed, 2 insertions(+), 261 deletions(-) delete mode 100644 docs/faq/graphql-vs-rest.md delete mode 100644 docs/getting-started/graphql-ide/insomnia.md diff --git a/docs/faq/graphql-vs-rest.md b/docs/faq/graphql-vs-rest.md deleted file mode 100644 index 18857ff..0000000 --- a/docs/faq/graphql-vs-rest.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -layout: default -title: GraphQL vs REST -nav_order: 1 -parent: FAQ ---- - -# GraphQL vs Rest - - -## REST vs GraphQL - -If you’re familiar with our QuickBooks Online Accounting API (referred to as Accounting API for the remainder of this section), you may be used to the REST framework. In this section, we’ll go over some general differences between REST and GraphQL, and some differences between the Accounting API and the Ecosystem API. - -### HTTP request type - -In REST, you would do a GET request to retrieve data from the server and a POST, PATCH PUT or DELETE to modify data on the server. - - - -In GraphQL, all requests are POSTs and the body of the request tells the server what needs to be done. All of the HTTP calls are made the same way and to the same endpoint but with different request bodies. To retrieve data, you would use a query operation, and to modify data you would use a mutation operation. More on those operations [here](../../graphql-concepts). - -### Single endpoint vs multiple endpoints - -Let’s say you wanted to read an invoice and find out how that invoice was paid. In REST, these would typically be separate resources or entities called Invoice and Payment, which is what the Accounting API does. You would have to make one call to the Invoice endpoint to get the invoice information. You would then find the related Payment ID and then make another call to Payment endpoint to find out more information about the payment transaction. - - - -If you were to do this in GraphQL, you would be dealing with a single endpoint. Depending on the schema, you would make a call to one endpoint and ask for the Invoice fields you need and the fields on the related Payment. - -### Fetching data - -The Accounting API would return all the information it has about an entity that is queried. A simple read or query operation would return all the fields associated with the entity for the record that has been requested. - - - -The Ecosystem API gives you more control over what data you want from the server. Whether you are doing a query or a mutation, you can specify exactly which fields (and nested fields) you want from the server. - - - -### Schema updates - -In REST, schema updates may be notified to end-users via webhooks or release notes. GraphQL does this with the help of the [introspection query](../../graphql-concepts/introspection). - -### Identifiers - -In the Accounting API, when you query for records, each record comes with an ID, which is unique only within that entity. So you may have an Invoice with ID 123 and a Payment with ID 123. - -The ID's returned by the Intuit API are interoperable with the Accounting Rest API. - -### Error response - -The Accounting API returns HTTP status codes like 4** or 5** to indicate different types of errors. - - - -The GraphQL API handles errors differently. Errors related to the API gateway later will return status codes 4** or 5**, but API errors will return HTTP status code 200 and provide all of the necessary information within the response body. Refer to [this section](../../graphql-concepts/error-handling-best-practices) for more details. - -### Operations - - - -Let’s take a deeper dive into some common operations like create, read, update, delete, and query. We’ll take the example of the Accounting API’s Invoice entity for this section. An Invoice represents a sales form where the customer pays for a product or service later. It is associated with Items, Customers, and Payments. Although Invoice is not supported in the Ecosystem API, we’ll do a comparison between how we work with this entity in the Accounting API vs how we would hypothetically do this in the Ecosystem API. - - - -In all of the snippets below you will see that in the Accounting API (REST), the response will be the object with all of the fields. In the GraphQL API, however, you can specify which fields you want and only those fields are a part of the response. - - - -Note that these are illustrative examples only. For exact field names and operations, please refer to the Accounting API Reference and GraphQL introspection. - -### Create an invoice -### REST -Request: -POST `/v3/company//invoice` -``` -{ - "Line": [ - { - "DetailType": "SalesItemLineDetail", - "Amount": 100.0, - "SalesItemLineDetail": { - "ItemRef": { - "name": "Services", - "value": "1" - } - } - } - ], - "CustomerRef": { - "value": "1" - } -} -``` - -Response: -``` -{ - "Invoice": { - "Id": "238", - "DocNumber": "1069", - "Balance": 100.0, - "TxnDate": "2020-07-24", - "TotalAmt": 100.0, - "CustomerRef": { - "name": "Amy's Bird Sanctuary", - "value": "1" - }, - "ShipAddr": { - "City": "Bayshore", - "Line1": "4581 Finch St.", - "PostalCode": "94326", - "CountrySubDivisionCode": "CA", - "Id": "109" - }, - "DueDate": "2020-08-23", - "Line": [ - { - "Amount": 100.0, - "SalesItemLineDetail": { - "TaxCodeRef": { - "value": "NON" - }, - "ItemRef": { - "name": "Services", - "value": "1" - } - }, - "DetailType": "SalesItemLineDetail" - } - ], - ... other fields ... -} -``` - - -### GraphQL -Request: -POST `/v1` -``` -mutation Create{ - createInvoice(item: {type: "inventory", amount: 100, itemref: "111"}, customerRef: "222", paymentRef: "333") { - id - docNumber - } -} -``` - -Response: -``` -{ - "id": 1, - "docNumber": "101" -} -``` - - -The above are only illustrative examples. To get a full list of operations and resources available in the Grapqh API, use the API reference docs [here](). You can also refer to our collections for Insomnia and Postman [here](). diff --git a/docs/getting-started/graphql-ide/graphql-ide.md b/docs/getting-started/graphql-ide/graphql-ide.md index bc69daa..bad7e69 100644 --- a/docs/getting-started/graphql-ide/graphql-ide.md +++ b/docs/getting-started/graphql-ide/graphql-ide.md @@ -7,25 +7,6 @@ permalink: /docs/getting-started/graphql-ide/ parent: Getting Started --- -# Testing queries using a GraphQL IDE - -Use a GraphQL Integrated Developer Environment (IDE) to test and validate queries during development. - -Here are the basic steps to set up, download a GraphQL IDE, and send a test query for your test company. - -## Step 1: Set up your app in the Intuit Developer Portal - -If you haven't already, [get a QuickBooks Online company](../authentication/) for testing, [create your app](../authentication/), and get your app's [**Client ID** and **Client Secret**](../authentication/). - -## Step 2: Get a GraphQL IDE - -There are many GraphQL IDEs available. Use the one you prefer. - -Here are a couple we recommend. In particular, we prefer Insomnia for its collection and built-in authorization features. - -* [Set up and test with Insomnia](./insomnia) - -## Step 3: Send a test query - -After you install a GraphQL IDE, use the sample queries from the [Schema Entities](../../schema-entities/) folder to test get data for your test company.. +# Testing +Follow a links to get started with testing Intuit API. \ No newline at end of file diff --git a/docs/getting-started/graphql-ide/insomnia.md b/docs/getting-started/graphql-ide/insomnia.md deleted file mode 100644 index afeb166..0000000 --- a/docs/getting-started/graphql-ide/insomnia.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -layout: default -title: Insomnia -nav_order: 1 -parent: Testing -grand_parent: Getting Started -permalink: /docs/getting-started/graphql-ide/insomnia ---- - -# Set up and test with Insomnia - -You can [start with the free version of Insomnia](https://insomnia.rest/products/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](https://support.insomnia.rest/article/23-installation). - -## Step 1: Set up your app in the Intuit Developer Portal - -If you haven't already, [get a QuickBooks Online company](../authentication/) for testing, [create your app](../authentication/), and get your app's [**Client ID** and **Client Secret**](../authentication/). - -## Step 2: Add the Insomnia redirect URI - -1. [Sign in](https://developer.intuit.com/app/developer/myapps) to your developer account. -2. Select the **Dashboard** link on the toolbar. -3. Select and open your app. -4. In the **Production Settings** section, select **Keys & credentials**. -5. In the **Redirect URIs** section, select **Add URI**. -5. Enter the insomnia redirect URI: **https://insomnia.rest**. - -## Step 3: Download and set up Insomnia -1. [Download the latest version](https://insomnia.rest/download) of Insomnia. -2. Launch and install Insomnia. -3. Select the **Manage environments** option. -4. 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://qb.api.intuit.com/graphql" -} -``` -This configures and connects Insomnia to your app and Intuit API. - -## Step 4: Start a test query in Insomnia -1. Select the **(+)** icon and then **New Request**. -2. Name the request. -3. Select the **POST** method from the dropdown. -4. Select the **URL** environment variable. You set up the environment in Step 2. -5. Select **GraphQL query** as the query type. -6. Select **Create**. - -This opens a query window. Use the sample queries from the [Schema Entities](../../schema-entities/) folder to test get data for your test company. - - - -## Step 5: Configure authorization variables Insomnia -In the query window, set the OAuth2.0 environment variables: - -1. Select the **OAuth 2.0** tab. -2. From the **Grant type** dropdown, select **Authorization code**. -3. In the Authorization URL field, enter **Authurl**. -4. In the Access Token URL field, enter **AccessTokenUrl**. -5. In the Client ID field, enter **ClientId**. -6. In the Client Secret field, enter **ClientSecret**. -7. In the Redirect URL field, enter **RedirectUrl**. -8. Select the **Enabled** checkbox. - -![](/intuit-api/assets/images/oauth2.png) - -## 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 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. \ No newline at end of file