Created
April 10, 2020 15:04
-
-
Save yob/bae198b7d7a7da9e10de538171eeeced to your computer and use it in GitHub Desktop.
buildkite graphql sample, via ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
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