GraphQL APIs

Paycor Legacy Support

July 27th, 2024 Updated

The application 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 the application 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 application's 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 instance. 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 the application 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
}
}
}
}
}
}
}
}
}
}
}
}

Get objectives data: request example using get-user-context-objectives-query.js

query getObjectivesIOwn($userId: Float!) {
objectivesIOwn: objectives(owner: $userId, first: 1) {
edges {
node {
name
pk
name
closed
draft
private
objectiveType
overallAssessmentStatus
progress
dueDatetime
startDate
completedDatetime
currentUserParticipantType
childObjectivesWeightedProgress
childObjectivesHaveNoWeight
owners(first: 10) {
edges {
node {
pk
fullName
}
}
}
followers(first: 10) {
edges {
node {
fullName
pk

}
}
}
relatedChildObjectives(first: 2) {
totalCount
edges {
node {
childObjective {
name
pk
objectiveType
}
}
}
}
parentObjectives(first: 10) {
edges {
node {
pk
name
objectiveType
}
}
}
keyResults(first: 10) {
edges {
node {
id:pk
name
targetValue
currentValue
startingValue
measurementType
progress
owners(first: 10) {
edges {
node {
pk
name:fullName
profileImageUrl
}
}
}
integration {
... on JiraKeyResultIntegrationNode {
lastSyncError
type
}
... on GoogleSheetsKeyResultIntegrationNode {
lastSyncError
type
}
... on SalesforceKeyResultIntegrationNode {
lastSyncError
type
}
}
}
}
}
}
}
}
}

Get objectives data: response example

{
"data": {
"objectivesIOwn": {
"edges": [
{
"node": {
"name": "Increase recurring revenues",
"pk": 9,
"closed": false,
"draft": false,
"private": false,
"objectiveType": 2,
"overallAssessmentStatus": 2,
"progress": 2.85,
"dueDatetime": "2019-06-30T23:59:59+00:00",
"startDate": "2019-04-01",
"completedDatetime": null,
"currentUserParticipantType": 1,
"childObjectivesWeightedProgress": 1.72,
"childObjectivesHaveNoWeight": false,
"owners": {
"edges": [
{
"node": {
"pk": 4,
"fullName": "Cameron Chen"
}
}
]
},
"followers": {
"edges": []
},
"relatedChildObjectives": {
"totalCount": 1,
"edges": [
{
"node": {
"childObjective": {
"name": "Improve satisfaction with support team's work",
"pk": 10,
"objectiveType": 2
}
}
}
]
},
"parentObjectives": {
"edges": [
{
"node": {
"pk": 1,
"name": "Be excellent - improve to be the best in whatever we do",
"objectiveType": 3
}
}
]
},
"keyResults": {
"edges": [
{
"node": {
"id": 28,
"name": "Reach monthly recurring revenue ($ MRR) of $250k",
"targetValue": 250000,
"currentValue": 100,
"startingValue": 0,
"measurementType": 3,
"progress": 0.04,
"owners": {
"edges": []
},
"integration": null
}
},
{
"node": {
"id": 29,
"name": "Increase the share of monthly subscriptions vs one-time contracts sold to 85%",
"targetValue": 85,
"currentValue": 3.54,
"startingValue": 0,
"measurementType": 3,
"progress": 4.16,
"owners": {
"edges": []
},
"integration": null
}
},
{
"node": {
"id": 30,
"name": "Increase % annual renewals to 75%",
"targetValue": 75,
"currentValue": 3.13,
"startingValue": 0,
"measurementType": 3,
"progress": 4.17,
"owners": {
"edges": []
},
"integration": null
}
},
{
"node": {
"id": 31,
"name": "Reduce churn % to less than 1% monthly",
"targetValue": 100,
"currentValue": 4.17,
"startingValue": 0,
"measurementType": 3,
"progress": 4.17,
"owners": {
"edges": []
},
"integration": null
}
}
]
}
}
}
]
}
}
}

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
}
}