Showing results for 
Show  only  | Search instead for 
Did you mean: 

New Quizzes Public API: REST or GraphQL?

8 16 4,017

Who is this blog post for?

If you or your institution call or plan to call Canvas API for any Quizzes endpoints for automation or third party integration, this blog post will definitely interest you. 

New Quizzes will introduce a new publicly accessible API. We would like to provide the smoothest transition to NQ as it is possible. We’re also thinking about the long-term benefits. We want to hear your voice before making the decision about REST or GraphQL for the New Quizzes API. 

Why GraphQL? Why now?

Why are we thinking about changing to GraphQL and why now? There are 2 main reasons:

  1. You may already know that Instructure leans towards GraphQL more and more, eventually all our APIs will be GraphQL based including New Quizzes API.  
  2. Currently it’s unknown how much, but New Quizzes API will differ from the current Quizzes API regardless of the choice of API type. If the New Quizzes API is created as REST, the learning curve might be smaller, requiring code changes in a paradigm you're used to. However, you would need to change your client-side code twice in the future. A second update would be necessary when all of Instructure uses GraphQL exclusively.

I believe this could be a good opportunity for future-proofing your code in one step, but want to understand the impact to you.

What is GraphQL?


You may wonder what GraphQL is and why we even talk about it. GraphQL is a query API language that executes queries by using a type system based on defined input data, you can read more about our GraphQL solution here and you can reach the official GraphQL site here.

Main advantages of GraphQL

  1. The substance of what gets sent over the wire from server to client is closely related to what you want for your use case both in shape and volume, rather than fetching everything and sorting/organizing on the client side.  This reduces the transmission of data you don’t care about for this specific request, and therefore is more efficient (though the magnitude of that efficiency is obviously proportional to just how much over-fetching happens for a given use case).
  2. The ability to flexibly fetch several connected entities in a single request rather than making a request for some entry point you know about, parsing the response, and then fetching children or related entities based on a predicate that could be communicated in a GraphQL query.  This reduces the network overhead of having to make multiple requests.  

GraphQL or REST for New Quizzes API

We would like to hear about your preferences. Please fill out our survey and if you have any additional remarks or questions, don’t hesitate to add a comment to this post!