7Geese exposes a GraphQL API which can be used to access your organization's data. To learn more about GraphQL, visit https://graphql.org/.

GraphQL

You can access a web-based GraphQL client at https://app.7geese.com/graphql. It allows you to write and execute queries, and to browse the generated API documentation. When you use this page, you must already be logged into 7Geese in the same browser. The GraphQL client will run in the context of whichever user you’re currently logged in as. This can be useful for experimenting with queries and exploring the API, but if you intend to use the API in an actual application, you will likely want to use OAuth-based authentication, described below.

Insomnia

Insomnia (https://insomnia.rest) is a useful application for interacting with APIs, and will be used in the following example to demonstrate how to query the 7Geese GraphQL API.

  1. Go to https://app.7geese.com/account/applications/ and create a new application. Name it whatever you want and select "Authorization code" as the "Authorization grant type". Set the "Redirect URIS" to "https://insomnia.rest"
  2. In Insomnia, click the + button to create a new request. Name it whatever you want, set the method to POST and the body type to "GraphQL Query"
  3. Switch to the Auth tab and select OAuth 2
  4. The grant type should default to Authorization Code. Set the "Authorization URL" to "https://app.7geese.com/o/authorize/". Set the "Access Token URL" to "https://app.7geese.com/o/token/?client_id=<clientid>&redirect_uri=https://insomnia.rest", substituting the client ID that was generated for your 7Geese application. Set the "Client ID" and "Client Secret" fields to the values generated for your application. Leave the "Redirect URL" blank.
  5. Click the "Fetch Tokens" button and login to 7Geese and authorize the app in the window that pops up
  6. Switch back to the graphQL tab and make sure the URL in the address bar (at the top of the window, next to the text "POST") is set to https://app.7geese.com/graphql
  7. Enter a query like the following and run it:
{
  profiles(first:10) {
    edges {
      node {
        pk
        fullName
      }
    }
  }
}

This will fetch the first 10 user profiles from your organization. If you want, you can now use Insomnia to generate code in a variety of languages or as a curl command that will run the same query. Or you can the information that Insomnia provides to see what the HTTP request that was made looks like, for usage in your own application.

Example Queries

Get a list of user profiles along with each user’s open objectives.

{
  profiles(first:50) {
    edges {
      node {
        fullName
        ownedObjectives(closed:false, first:10) {
          edges {
            node {
              name
              progress
            }
          }
        }
      }
    }
  }
}

Get the 10 most recent feedbacks that the current user has access to. For each feedback request, display the title, when it was sent, who sent it, the list of questions, the responders and their answers.

{
  feedbackRequests(first: 10, orderBy:"-sent_date") {
    edges {
      node {
        title
        sentDate
        creator{
          fullName
        }
        questionSet{
          questions(first:50){
          edges {
              node{
                ... on TextQuestionNode{
                  title
                }
                ... on RangeQuestionNode{
                  title
                  start
                  end
                }
                ... on LikertQuestionNode{
                  title
                  style
                  optionCount
                }
                ... on MultiOptionQuestionNode{
                  title
                  options(first:10) {
                    edges {
                      node {
                        title
                      }
                    }
                  }
                }

              }
            }
          }
        }
        responders(first:20) {
          edges {
            node {
              profile{
                fullName
              }
              feedback{
                answers(first:50) {
                  edges {
                    node {
                      ... on TextAnswerNode{
                        answer
                      }
                      ... on RangeAnswerNode{
                        rangeAnswer:answer
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Scopes


As with the RESTful API, when using the GraphQL API with an OAuth token, your token will have a set of permission scopes associated with it. See the RESTful API documentation for a list of possible scopes and how to request them.

If you're using the GraphiQL GraphQL client (which does not use OAuth) you can find out which scopes are required for a query by fetching the requiredScopes field.

{
  requiredScopes
  objective(pk: 688) {
    pk
  }
}
Did this answer your question?