Examples

This is not comprehensive documention for the API, but is a list of useful examples to get you started.

For complete structure check out the full schema documentation.

Queries

channels

REQUEST
Copy
query {
  channels {
    nodes {
      id
      name
      description
      privacyLevel
      imageUrls
      objective
      orgDiscoverable
      analyticsEnabled
      createdOn
      archivedOn
      planId
      members {
        userId
      }
      content {
        id
      }      
    }
  }
}

RESPONSE
{
  "data": {
    "nodes": [
      {
        "id": "channel-id",
        "name": "My Channel",
        "description":, "Channel description goes here",
        "privacyLevel": "private",
        "imageUrls": [
          "https://image.url.com/3223"
        ],
        "objective": null,
        "orgDiscoverable": false,
        "analyticsEnabled": false,
        "createdOn": "2020-02-20T23:23:26.481Z",
        "archivedOn": "2020-02-20T23:23:26.481Z",
        "planId": "my-plan",
        "members": [
          {
            "userId": "31784e54-979f-4b14-813e-4e8f12f1390d"
          }
        ],
        "content": [
          {
            "id": "54824e54-979f-4b14-813e-4e8f12f1845c"
          }
        ]
      }, ...
    ]
  }
}

skillAssessmentResult

REQUEST
Copy
query {
  skillAssessmentResults {
    nodes {
      user{
      	firstName
      	lastName 
        email
      }
      quintileLevel
      skillName
      completedOn
      isCurrentScore
    }
  }
}

RESPONSE
{
  "data": {
    "skillAssessmentResults": {
      "nodes": [
        {
          "user": {
            "firstName": "John",
            "lastName": "Snow"
            "email": "[email protected]"
          },
          "quintileLevel": "proficient-average",
          "skillName": "MySQL",
          "completedOn": "2021-06-18T18:22:14.414Z",
          "isCurrentScore": true
        }, ...
      ]
    }
  }
}

roleIqCatalog

REQUEST
Copy
query { 
  roleIqCatalog {
    nodes {
      id
      name
      createdByUser
      roleIcon
      status
      createdOn
      updatedOn
    }
  }
}

RESPONSE
{
  "data": {
    "roleIqCatalog": {
      "nodes": [
        {
          "id": "2db5e38e-19b6-40e0-b366-c4555467c945",
          "name": "Python Data Scientist",
          "createdByUser": "Grace Hopper",
          "roleIcon": "https://s2.pluralsight.com/roleiq/imgs/badge_tableau_analyst.svg",
          "status": "live",
          "createdOn": "2018-11-13T04:41:36.351Z",
          "updatedOn": "2018-11-13T04:46:49.929Z"
        },...
      ]
    }
  }
}

courseProgress

REQUEST
Copy
query {
  courseProgress {
    nodes {
      user{
        email
        firstName
        lastName
      }
      course{
        title
        authors
      }
      percentComplete
      isCourseCompleted
      completedOn
      courseSeconds
      totalWatchedSeconds
      totalClipsWatched
      firstViewedClipOn
      lastViewedClipOn
    }
  }
}

RESPONSE
{
  "data": {
    "courseProgress": {
      "nodes": [
        {
          "user": {
            "email": "[email protected]",
            "firstName": "John",
            "lastName": "Snow"
          },
          "course": {
            "title": "Google Cloud Platform Big Data and Machine Learning Fundamentals",
            "authors": [
              "Google Cloud"
            ]
          },
          "percentComplete": 1.34266,
          "isCourseCompleted": false,
          "completedOn": null,
          "courseSeconds": 17786,
          "totalWatchedSeconds": 15,
          "totalClipsWatched": 2,
          "firstViewedClipOn": "2021-06-02T19:07:08.543Z",
          "lastViewedClipOn": "2021-06-02T19:07:13.952Z"
        }, ...
      ]
    }
  }
}

users

REQUEST
Copy
query {
  users {
    totalCount
    nodes {
      id
      email
      firstName
      startedOn
    }
  }
}

RESPONSE
{
  "data": {
    "users": {
      "nodes": [
        {
          "id": "faaa75f3-5555-47b5-b9cb-d409f338fcad",
          "email": "[email protected]",
          "firstName": "Obidiah Dogberry",
          "startedOn": "2017-08-29T20:11:01.750Z"
        }
      ]
    }
  }
}

Mutations

addChannel

REQUEST
Copy
mutation {
  addChannel(input: {
    createdByUserHandle: "dse84kfi-ace3-4c87-9608-2346957839c2"
    description: "My New Channel"
    planId: "got-plan"
    privacyLevel: "private"
  }) {
    channel {
      id
      privacyLevel
      archivedDate
      description
      imageUrls
      objective
      orgDiscoverable
      analyticsEnabled
      createdDate
      content {
        channelId
      }
    }
  }
}

RESPONSE
{
  "data": {
    "addChannel": {
      "channel": {
        "id": "0175eeb5-a7ae-46a5-912d-24ba9b9be188",
        "privacyLevel": "private",
        "archivedDate": null,
        "description": "My New Channel",
        "imageUrls": [],
        "objective": null,
        "orgDiscoverable": false,
        "analyticsEnabled": false,
        "createdDate": "2019-06-18T22:52:29.805Z",
        "content": []
      }
    }
  }
}

addTeam

REQUEST
Copy
mutation {
  addTeam(input: {
    name: "My New Team"
    description: "team description"
  }) {
    id
    name
    description
    groupId
  }
}

RESPONSE
{
  "data": {
    "addTeam": {
      "id": "83852b29-3443-4061-81bb-a51c5bcde91e",
      "name": "My New Team",
      "description": "team description",
      "groupId": null
    }
  }
}

Interfaces

For more complete documentation about querying Interfaces please reference this Apollo Documentation.

channelContent and channelContentSection

Here is a useful example of how you can query our channelContent Interface using the on syntax to collect specific information belonging to each subfield (Section, External Link Section, and External Link)

REQUEST
Copy
query {
  channelContent 
  {
    nodes {
      id
      channelId
      index
      type
      ... on Section {
        name
        description
        content { 
          id
          index
          type
          ... on ExternalLinkSection {
            url
            title
            contentType
            level
            durationInSeconds
          }
        }
      }
      ... on ExternalLink {
        url
        title
        contentType
        level
        durationInSeconds
      }
    }
  }
  
}

RESPONSE
{
  "data": {
    "channelContent": {
      "nodes": [
        {
          "id": "4b0e87b1-b9c0-49fe-8887-37e4a7bd02d4",
          "channelId": "00090c61-26d9-4cfd-bc7a-eb85c9e01813",
          "index": 1,
          "type": "skill-assessment"
        },
        {
          "id": "b22e9b04-9778-4a1d-882a-9b84a30869f9",
          "channelId": "57e637ed-6e78-48d9-9281-6475c8c82617",
          "index": 3,
          "type": "course"
        },
        {
          "id": "4e65f933-0e21-4c5f-a177-01f9620b8f43",
          "channelId": "0063b512-469e-4dc7-9f34-1449f869cd58",
          "index": 0,
          "type": "section",
          "name": "This is a Section!,
          "description": "This is a Section Description",
          "content": [
            {
              "id": "62443150-2c87-43b2-9d81-f9b79fd624b7",
              "index": 1,
              "type": "course"
            },
            {
              "id": "2365049d-fb66-4ffd-b768-031ff7d13d26",
              "index": 2,
              "type": "external-link",
              "url": "https://learn.pluralsight.com/resource/tutorial/how-to-use-pluralsight",
              "title": "How to use Pluralsight",
              "contentType": "External Link",
              "level": null,
              "durationInSeconds": 60
            }
        },
        {
          "id": "65b73e3e-296b-4e53-bbb8-ab8da1ff66f9",
          "channelId": "00cdd9aa-363a-4b65-a347-ac365b608baa",
          "index": 7,
          "type": "external-link",
          "url": "https://blog.angular.io/",
          "title": "Angular Blog",
          "contentType": "Article",
          "level": null,
          "durationInSeconds": 60
        }
      ]
    }
  }
}