Overview

Queries are "read only" requests to retrieve data using the SparkThink API. We will walkthrough the main types of queries that you can perform in SparkThink API:

  1. Me (used to provide info on the user associated with the bearer token)
  2. Projects (used to list out the projects that match a search term)
  3. Project (used to drill down on a specific project)

Me

Description

This query provides information on the user associated with the bearer token, including the list of projects associated with the user. It is primarily used to understand the projects that are associated with the current user.

General Structure

query {
  me 
  {
    field1
    field2
    field3 {
      nested_field_1
      ...
    }
    ...
  }
}

Arguments

There are no arguments for this query.

Fields

Name Type Description
user User The Admin user associated with the Service Account

Example Query

query {
  me {
    id
    name
    email
    projects {
      id
      title
    }
  }
}

Example Response

{
  "data": {
    "me": {
      "id": "15f54f22-7c28-45e1-a784-82a51413e79a",
      "name": "Roger Chan",
      "email": "roger.chan@slalom.com",
      "projects": [
        {
          "id": "6269a574361cd3004684378f",
          "title": "Test for Survey"
        },
        {
          "id": "62586b8b361cd30046843760",
          "title": "QA test survey - Story 16474"
        }
      ]
    }
  }
}

Notes

You will only see the projects that the Admin user associated with the service account has created or has been added as an administrator

Projects

Description

This query displays all the projects that match the specified project type and search string. This is best used when searching for a specific project.

General Structure

query {
  project 
  {
    field1
    field2
    field3 {
      nested_field_1
      ...
    }
    ...
  }
}

Arguments

Name Type Description
titleContains String Search string
type ProjectType The project type (i.e. Survey, Workshop, Assessment)

Fields

Name Type Description
[Project] Project An array of the projects that match the search string and project type

Example Query

query {
  projects (titleContains: "test", type: Survey) {
    id
    title
    status
    }
}

Example Response

{
  "data": {
    "projects": [
      {
        "id": "6269a574361cd3004684378f",
        "title": "Test for Survey",
        "status": "OPEN"
      },
      {
        "id": "62586b8b361cd30046843760",
        "title": "QA test survey - Story 16474",
        "status": "OPEN"
      }
    ]
  }
}

Project

Description

This query provides information on a specific individual project, including the project metadata, team members, responses, respondents, and collectors. This is best used to drill down on the details of a specific project.

General Structure

query {
  projects 
  {
    field1
    field2
    field3 {
      nested_field_1
      ...
    }
    ...
  }
}

Arguments

Name Type Description
id String The unique project ID
type ProjectType The project type (i.e. Survey, Workshop, Assessment)

Fields

Name Type Description
Project Project The actual project including metadata, responses, collectors, respondents etc.

Example Queries

query {
  project(id: "6269a574361cd3004684378f", type: Survey) {
    id
    clientName
    description
    title
    status
    ... on Survey {
      questions {
        id
        content {
          description
          title
          ... on MultipleChoiceContent {
            allowMultiple
            answers {
              id
              label
            }
          }
        }
      }
    }
  }
}

Example Responses

{
  "data": {
    "project": {
      "id": "6269a574361cd3004684378f",
      "clientName": "Slalom",
      "description": "",
      "title": "Test for Survey",
      "status": "OPEN",
      "questions": [
        {
          "id": "6269a57b361cd30046843790",
          "content": {
            "description": "",
            "title": "Do you like icecream?",
            "allowMultiple": false,
            "answers": [
              {
                "id": "c6bcdbdd-741d-4fa7-88c3-5d5f47689a70",
                "label": "Yes"
              },
              {
                "id": "2072cd90-dbbe-4214-bc40-2fb2bd5dfc9a",
                "label": "No"
              }
            ]
          }
        }
      ]
    }
  }
}