Skip to content

Instantly share code, notes, and snippets.

@rmela
Last active September 26, 2020 14:54
Show Gist options
  • Save rmela/d24c211e5588ff919bb8d00d3566b592 to your computer and use it in GitHub Desktop.
Save rmela/d24c211e5588ff919bb8d00d3566b592 to your computer and use it in GitHub Desktop.
curl --header "Authorization: bearer <your-github-api-token-here>" https://api.github.com/graphql \
-d '{"query":"query { viewer { login } }"}'
const https = require( "https" )
const TOKEN="<your-github-token-here>"
const QUERY = JSON.stringify( {query: "query { viewer { login }}"} )
const OPTIONS = {
method: "POST",
hostname: "api.github.com",
path: "/graphql",
headers: {
"Authorization":`bearer ${TOKEN}`,
"User-Agent":"Rob-O-Matic 3000",
"Content-Length": QUERY.length
}
}
https
.request( OPTIONS, res => res.pipe(process.stdout) )
.write( QUERY )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment