cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dtod
Community Contributor

Graphql query to return enrollments in a known course with a specific status

Jump to solution

I can write a query that returns all the enrollments in a known course (see below), but how would you write something that only returned enrollments whose status was "invited"? It should be possible, but I'm banging my head against a brick wall on this. 

query MyQuery {
  course(id: "179404") {
    enrollmentsConnection {
      nodes {
        state
        user {
          name
        }
      }
    }
  }
}

 

Labels (1)
0 Kudos
1 Solution

Accepted Solutions
werner_huysman1
Community Participant

Hi, I don't think it is possible to use state as a filter. I believe your only option is to filter the result while parsing the json response. Are you using the query in an application, or are just looking for a list of enrollments with the state invited?

View solution in original post

0 Kudos
3 Replies
werner_huysman1
Community Participant

Hi, I don't think it is possible to use state as a filter. I believe your only option is to filter the result while parsing the json response. Are you using the query in an application, or are just looking for a list of enrollments with the state invited?

0 Kudos
dtod
Community Contributor

List of enrollments with the state invited. I know the REST API does this well and I could use an SIS file, but I was hoping to start using the graphql API more since that's the direction that they're going, and also I could perhaps do a mutation (that's my intent, i.e. set people as active rather than invited).

werner_huysman1
Community Participant

In order to get this list, I would paste the json result of your query in a json2csv converter like https://konklone.io/json/ and filter on the state.