Skip to content

Instantly share code, notes, and snippets.

@sgrove
Last active Jul 12, 2018
Embed
What would you like to do?
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