GRAPHQL returns incorrect course ID

StephenLiseo
Community Member

Hi 

I am writing some python to automate a few processes in Canvas via API calls.

Using the following query:

query CoursesByTerm ($term:ID!) {
  term(id$term) {
    id
    name
    coursesConnection {
      nodes {
        _id
        name
      }
    }
  }
}

I get a list of courses in the term I require, however, some (about 1 in 4) of the courses return an incorrect course ID:

for example

                        "_id""19783",
                        "name""Year 7 Science (2023)"
 

The correct ID is actually 19784. There is no 19783 course.

I get the same results from the Canvas GRAPHIQL page, postman and python. If I use the /API/V1 I get the correct course ID.

Disclaimer I am very new to working with API's and Python.

Any help or insights would be greatly appreciated

Thanks

0 Likes