Skip to content

Instantly share code, notes, and snippets.

@KonnorRogers
Last active January 14, 2019 17:47
Show Gist options
  • Save KonnorRogers/6a26350749bd890789f1271bbb847114 to your computer and use it in GitHub Desktop.
Save KonnorRogers/6a26350749bd890789f1271bbb847114 to your computer and use it in GitHub Desktop.
GitHub API v4 requests
# For forming a github v4 API request via Net::HTTP
# load the library, it will auto require the uri library
require 'net/http'
# githubs api url
endpoint_url = 'https://api.github.com/graphql'
# json formatted graphql request
# taken from docs - api v4
# NOT FINISHED
graphql_request = { query {
repository(owner: "ParamagicDev", name: "vps_setup")
}
}.to_json
# all graphql requests are post requests unless introspective requests
Net::HTTP.post(
URI(endpoint_url, graphql_request)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment