First Query to test
https://www.lukeko.com/38/first-query-to-test 0Test your token (Replace x123... below with your Wave Access token)
curl -X POST "https://gql.waveapps.com/graphql/public" \
-H "Authorization: Bearer x12345678901234567890123456789" \
-H "Content-Type: application/json" \
-d '{ "query": "query { user { id defaultEmail } }", "variables": {} }'
If your access token is correct you will get a response like this
{"data":{"user":{"id":"VXNlcjo4NzRlNDA3NS1mNzhhLTRkNzktODhlMy01MmM1MWE5YjE4ZGI =","defaultEmail":"example@example.com"}}}
And just like that you're in business
You can do the same query in a Ruby script like this
require 'faraday'
require 'json'
url = 'https://gql.waveapps.com/graphql/public'
params = {'query': 'query { user { id defaultEmail } }', 'variables': {} }
response = Faraday.post(url, params.to_json,
"Authorization" => "Bearer x12345678901234567890123456789",
"Content-Type" => "application/json")
or if you don't want to use a gem
require 'uri'
require 'net/http'
require 'json'
url = 'https://gql.waveapps.com/graphql/public'
params = {'query': 'query { user { id defaultEmail } }', 'variables': {} }
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
response = http.post(uri.path, params.to_json,
"Authorization" => "Bearer x12345678901234567890123456789",
"Content-Type" => "application/json")
puts response.body