GraphQL without Apollo

I'm just trying to access the GQL api without Apollo, and I seem to be missing something. I've got the correct url, correct token, and correct ref, but I'm getting an html 404 page. Is there anything else I need to get it working?

var request = require("request");

var options = { method: 'POST',
  url: 'https://{{repo}}.prismic.io/graphql',
  headers: 
   { Authorization: 'Token {{token}}',
     'Prismic-ref': '{{ref}}' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Turns out it was an error on my part. Sorry!

Hey Mike,

Welcome to the community!

I’m glad you figured this out. Can you tell us what the issue was? It might help future people in your position.

Thanks.

Sure, Phil! It turns out I just had a typo in my repo url. Additionally, the code above should use method GET.

Happens to everyone. Thanks for the extra info. Let us know if you need anything else.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.