Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

The following queries are SAMPLES. As a consumer of the Scope GraphQL API, you can design and use any properly formed query to retrieve the data that you require.

For more information, see “Introduction to the Scope GraphQL API“.

Use Case: Session Data Retrieval

Problem

As an analyst, I want to know which users have completed a particular Scenario so that I can issue credit to the users relating to the associated learning module in my system-of-record.

Solution

I will use a GraphQL client to retrieve Scenario Session data from the Scope GraphQL API which is not otherwise available in the Scope CMS user interface.

Procedure

  1. The GraphiQL client application is installed and configured to communicate with the Scope GraphQL API (see “Exploring the Graph”)

  2. The following query is executed:

    query {
      node(id: "INSERT_ID_OF_SCENARIO") {
        ... on Scenario {
          sessions {
            nodes {
              id
              state
              user {
                id
                name
              }
            }
          }
        }
      }
    }
  3. The JSON response is reformatted to CSV (using any relevant tool) for merge with system-of-record data and/or reporting.

Retrieving A Single Scenario Session’s Data

query SampleScenarioSessionNodeQueryDemonstratingImportantFields($id: ID!) {
  node(id: $id) {
    ... on ScenarioSession {
      startedAt
      endedAt
      duration
      idleDuration
      numberOfStepsPossible
      numberOfStepsViewed
      percentOfStepsViewed
      state
      externalData # NOTE: this is where query params passed from the System of Record can be found
      scenarioRelease {
        author {
          id
          name
        }
        publishedAt
        scenario {
          author {
            id
            name
          }
          description
          name
          originGroup {
            id
            name
          }
          publishedAt
        }
        type
        version
      }
      events {
        nodes {
          id
          createdAt
          receivedAt
          type
          externalData
        }
      }
      steps {
        nodes {
          scenarioStep {
            name
            orderIndex
            scenarioSequence {
              name
            }
          }
        }
      }
    }
  }
}

Retrieving All Scenario Session Data

query SampleAllScenarioSessionsQueryDemonstratingImportantFields {
  viewer {
    organization {
      scenarioSessions {
        nodes {
          startedAt
          endedAt
          duration
          idleDuration
          numberOfStepsPossible
          numberOfStepsViewed
          percentOfStepsViewed
          state
          externalData # NOTE: this is where query params passed from the System of Record can be found
          scenarioRelease {
            author {
              id
              name
            }
            publishedAt
            scenario {
              author {
                id
                name
              }
              description
              name
              originGroup {
                id
                name
              }
              publishedAt
            }
            type
            version
          }
          events {
            nodes {
              id
              createdAt
              receivedAt
              type
              externalData
            }
          }
          steps {
            nodes {
              scenarioStep {
                name
                orderIndex
                scenarioSequence {
                  name
                }
              }
            }
          }
        }
      }
    }
  }
}


  • No labels