Totara Learn Open Discussions

Using GraphQL APIs get_courses

 
Senka Grossauer
Using GraphQL APIs get_courses
بواسطة Wednesday, 24 May 2023, 3:25 AM - Senka Grossauer
 

Hi,

we are running a 17.3 version and would like to use GraphQL APIs to get the information about courses (in particular course summary). Following the steps in the documentation you provided, I managed to get the token back as well as the OK status, also the information about users, etc. so I would say that it generally works. What happens when I try to call this:

query get_courses {
  get_courses {
    fullname
    category {
      name
    }
  }
}
is that I get empty data back:

{
    "data": []
}
Initially I thought that it might be a permission problem, that the API test user doesn't have a permission to view courses, and I even expended the default API role in the system (adding bunch of other permissions around courses) but it still didn't help.

Does anyone maybe face the same problem? Any hints in which direction I should look?

Thanks!

Best regards,

Senka