Skip to content

Instantly share code, notes, and snippets.

@yob
Created April 10, 2020 15:04
Show Gist options
  • Save yob/bae198b7d7a7da9e10de538171eeeced to your computer and use it in GitHub Desktop.
Save yob/bae198b7d7a7da9e10de538171eeeced to your computer and use it in GitHub Desktop.
buildkite graphql sample, via ruby
#!/usr/bin/env ruby
require 'json'
require 'net/http'
query = <<-EOS
{
organization(slug: "example-slug") {
members(first: 100, email: "james@example.com") {
edges {
node {
user {
name
email
id
}
}
}
}
}
}
EOS
payload = JSON.dump(query: query)
puts payload
http = Net::HTTP.new("graphql.buildkite.com", 443)
http.use_ssl = true
request = Net::HTTP::Post.new("/v1")
request["Authorization"] = "Bearer 123abc"
request.body = payload
response = http.request(request)
puts response.code
puts response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment