Showing results for 
Search instead for 
Did you mean: 

Problems with using GraphiQL code in Insomnia

Jump to solution

GraphQL is totally new to me and while I've been able to create some queries in graphiql, when I try the same code in Insomnia, the IDs don't work and need to be altered. A course ID which is normally 7 digits and works when used in graphiql needs to have "29000000" pre-pended in Insomnia. I haven't been able to figure out what works when trying to get user information with a userID in Insomnia yet. Has anyone else run into this when creating queries outside of graphiql? Or found any documentation on this? I was hoping to rewrite my ruby scripts that use the api currently to using graphql.

Here is an example of the differences between graphiql and Insomnia:




Tags (3)
1 Solution

Accepted Solutions
Community Member

I just did some log-diving.  It looks like Insomnia is configured to hit, but it should be <yourinstitution>

View solution in original post

22 Replies


I'm totally new to GraphQL too, I've copied a few queries people have dropped in their posts into GraphiQL and put it on my todo list. It's definitely becoming more popular, which hopefully means increased discussion and ideas. I also had no clue and hadn't thought about finding a GraphQL IDE yet, so thanks for the awareness. I've tested Insomnia, Altair, and Playground, all on MacOS today. Playground had a wonky UI and then gave me a blank white screen. edit: Both Altair and Insomnia have environments to make creating new queries easier using the same headers and url. Altair can pull in the schema docs.

Anyway, I tested each of your queries with multiple courseID variations with Insomnia and GraphiQL and I got data for each response. I have no idea where to start troubleshooting.  @jsavage2  mentioned ids for graphql yesterday, maybe he has an idea? Also checking # GraphQL API - Canvas LMS REST API Documentation 

This video is currently being processed. Please try again in a few minutes.
(view in My Videos)

Thanks for the video, carroll-ccsd. I'm on Windows, but wouldn't think that would matter. I've been through the documentation multiple times and and saw 

{   # NOTE: id arguments will always take either graphql or rest-style ids   c1: course(id: "1") {     _id     name   }   c2: course(id: "Q291cnNlLTE=") {     _id     name   } }

I'll keep trying.

Andrea, what URL are you using for Insomnia?


I just checked and {server}/api/graphiql comes back with an 422


{server}/api/graphql, no i for the /api/graphql

only i for graphiql browser interface

{server}/api/graphql is what I have been using in Insomnia. I work out my query with variables in {server}/graphiql, then I paste only the code into Insomnia,having a saved environment variable for the URL which points to api/graphql.

Learner II

Both formats work for me consistently. 

The longer format is the format of the ID used in Live Events and the Canvas Data Portal. It prepends your Shard ID...and a bunch of zeros.

In the other thread I was mentioning that, although it's undocumented, it seems to work in GrpahQL queries. I haven't run into any place it *has* to be used, though. Out of curiosity, are you using OAuth or Bearer Authentication in Insomnia?

I'll point out, too, that for common items (like courses) you don't have to use the legacyNode to use the legacy ID. The API will accept both ids as input to the "id:" argument:

query MyQuery ($courseID: ID!){
course(id: $courseID){

variables {
"courseID" : "1603"

is a valid query.

Was trying to make sure both were looking at the same instance and environment.

Someone suggested that you might be crossing Shards(29) or maybe trying 2 different instances.

Not the case.... hmmm

I'm using Bearer Authentication in Insomnia. Since I'm not a developer and I just create scripts to pull data for reports I need, the Bearer Authentication has worked well for me. Does the manner of authenticating make a difference with graphql?