In the Getting Started guide, we showed you how to establish your connection, obtain a token, and use it to get a valid response. In this guide, we will walk through how you can make additional queries.
As an example, we will be using the staging endpoint with sample data. In the Getting Started example, we stopped after getting one user. We used query arguments to request only one user by passing a limit of 1:
Let's query more users. Using Docs and Schema (located on the right of the screen; see above image), we can find out what information we could get for enrollment data. We still the need the right permissions to be able to get that data (you can learn about our roles and permissions system here).
Let's get information for 3 users: when they were created, when they last logged in, and what courses they are enrolled in:
Note: Because GraphQL provides a lot of power, we have to apply some limits to prevent abuse. We prevent extremely deep or complex queries by limiting query depth and complexity (here's an excellent article on GraphQL depth and complexity).
In the query, we used a limit query variable. There are many variables available for the users root query, as well as deeper level queries. Typically, each resource listing supports limit, offset (for pagination), sort and filter arguments.
Let's combine what we learned and look up plans that match to the "Demo" query, limiting our results to 2 plans only. For those, let’s look up which courses are provided by those plans:
We've successfully written our first query! To take things even further, check out our guide to Writing Your First Mutation.