Get Started

This quickstart walks you through:

  1. Setting up a TigerGraph schema and loading data to a TigerGraph instance.

  2. Access TigerGraph GraphQL service and connecting to the graph in the TigerGraph instance.

  3. Running GraphQL queries against the service.

  4. (Optional) Running a web application built on top of the service

1. Download example solution and data

  1. Download the example TigerGraph solution.

  2. Download the example data set and unzip it.

2. Load data

  1. Start up a TigerGraph instance, either locally or on TigerGraph Cloud.

  2. Navigate to the GraphStudio homepage and click Import an Existing Solution. Select the .tar.gz file you downloaded in the previous step/.

  3. In the upper left corner of the GraphStudio Home page, click Global View  DemoGraph to switch to the demo graph.

  4. On the left-side navigation, click Map Data To Graph, which should no longer be grayed out after switching out of global view.

  5. Click the Add Data File button and upload all the .csv files from the decompressed data folder. Click Publish data mapping to publish data mapping.

    Add data file
    Figure 2. Add data file
  6. Navigate to the Load Data page by clicking Load Data on the left-side navigation menu. Click the button in the toolbar above the canvas to start data loading.

After data loading completes, your graph is ready for use.

3. Access TigerGraph GraphQL Service

To access the GraphQL service, click the nine-dot icon in the top right corner of the screen and click GraphQL.

Right under the top pane in the up right corner, select the graph you want to query against. In this case, we’ll select DemoGraph.

graphql browser
Figure 3. GraphQL API in browser

4. Run a query

Let’s try running a simple query against the API. You’ll learn about running GraphQL queries on TigerGraph in more depth in the Queries section. For now, let’s run a simple query to get all person vertices in the graph and where they are born:

  • Query

  • Results

query {
  DemoGraph {
    person {
      name
      born_in {
        birthday
        to {
          name
        }
      }
    }
  }
}
{
  "data": {
    "DemoGraph": {
      "person": [
        {
          "born_in": [
            {
              "birthday": "1982-07-27 00:00:00",
              "to": {
                "name": "redwood city"
              }
            }
          ],
          "name": "John"
        },
        {
          "born_in": [
            {
              "birthday": "1991-12-21 00:00:00",
              "to": {
                "name": "san jose"
              }
            }
          ],
          "name": "Kevin"
        },
        {
          "born_in": [
            {
              "birthday": "1995-01-01 00:00:00",
              "to": {
                "name": "palo alto"
              }
            }
          ],
          "name": "Jenny"
        },
        {
          "born_in": [
            {
              "birthday": "1973-10-05 00:00:00",
              "to": {
                "name": "mountain view"
              }
            }
          ],
          "name": "Smith"
        },
        {
          "born_in": [
            {
              "birthday": "1990-09-12 00:00:00",
              "to": {
                "name": "redwood city"
              }
            }
          ],
          "name": "Tom"
        },
        {
          "born_in": [
            {
              "birthday": "1992-05-23 00:00:00",
              "to": {
                "name": "san jose"
              }
            }
          ],
          "name": "Emily"
        }
      ]
    }
  },
  "errors": null
}

5. Programmatically run a GraphQL query

The GraphQL service UI is a quick way to validate the query result. To programmatically run a GraphQL query or integrate with your application, you need to provide credentials to authenticate your requests. You can authenticate by including encrypted credentials in HTTP headers.

Type your TigerGraph username and password in the following format, with the two strings separated by a colon: <username>:<password>. For example, if your username is tigergraph and your password is password, it should be tigergraph:password.

Encode <username>:<password> using base64 encoding. In this example, you get dGlnZXJncmFwaDpwYXNzd29yZA==

Use this curl command to test it out:

curl --header “Authorization: Basic dGlnZXJncmFwaDpwYXNzd29yZA==” -X POST <TigerGraph-domain>:<port>/api/graphql/gsql/DemoGraph -d ‘{“query”:”query { DemoGraph { person { name born_in { birthday to { name } } } } }”, "variables": null}’