Skip to content

Instantly share code, notes, and snippets.

@sgrove
Last active July 12, 2018 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgrove/5f17d046e535763c3c85258054ed00fb to your computer and use it in GitHub Desktop.
Save sgrove/5f17d046e535763c3c85258054ed00fb to your computer and use it in GitHub Desktop.
Example multi-service query with OneGraph and GraphQL
{
## Retrieve a YouTube video by its id
youTubeVideo(id: "YX40hbAHx3s") {
snippet {
# Pull out the title
title
# Jump to the channel the video was uploaded to
uploadChannel {
snippet {
# Get the title of the channel
title
}
# Find all of the Twitter accounts associated with the YouTube channel
twitterLinks {
# Retrieve the first 5 tweets for each account
twitter(first: 5) {
tweets {
# For each tweet, pull out the text body
text
}
}
}
}
}
}
}
{
"data": {
"youTubeVideo": {
"snippet": {
"title": "P vs. NP and the Computational Complexity Zoo",
"uploadChannel": {
"snippet": {
"title": "hackerdashery"
},
"twitterLinks": [
{
"twitter": {
"tweets": [
{
"text": "RT @hankgreen: \"The universe is math on fire\" - Afterworlds, @ScottWesterfeld"
},
{
"text": "RT @carlzimmer: My @nytimes column this week: Can game theory fight cancer? http://t.co/WLaKrZM5T3"
},
{
"text": "RT @mitchellmoffit: How to make a baby - this gif is amazing! http://t.co/4v4TI5Enrg"
},
{
"text": "RT @vihartvihart: This game shows how good intentions lead to systemic problems. http://t.co/wlJ9jyr5KB Public domain. @ncasenmare http://t…"
}
]
}
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment