Repl.it api example
h
Coder100 (1303)

Hi everyone, so I asked a question on AMA and here is where I am now.

Introduction

To learn graphQL, go here and maybe you want to search up graphQL tutorial as well on google if you are not familiar with the querying language (it's like JSON but less strict and better)


Ok, now you want to go to the headers tab, and type in this:

{
  "X-Requested-With": "coder100",
  "Referrer":"https://repl.it"
}

X-requested-with can be anything and referrer IDK about.
Now it's time to do some query-ing!

Query the heck out of there

Now, in the editor, let's get all the information about you

# Write your query or mutation here
{
  userByUsername(username: "[username]") {
    karma, id, firstName, lastName, bio, isVerified
  }
}

Interestingly, cycles are called karma like on reddit....repl.it coins? lol

Share

Now, make a bash file on repl.it and copy the CURL code (located in the top right) and paste it in the REPL and click run. Ugly compressed JSON code should be seen (if not an error), and this is where you have to do some things. Where you see the username: "[username]" part, escape it out so it looks like username: \"[username]\". Ok, now go to your favorite JSON beautifier and look at the fruit of your labor.

ENJOY!

A REPL of mine is put on this tutorial to show you how awesome graphQL is!

Homework

Try to do this in node.js it won't be hard as all the headers necessary are there!

You are viewing a single comment. View All