Reputation: 343
I am new to graphql and I need a help to send graphql query with fragments for my android app. Below is the query format accepted by network.
query{
user(ident:"JohnDoe"){
myStory{
description,
placements(first:3){
edges{
node{
mediaItemType
mediaItem {
...VideoFragment
...PhotoFragment
}
}
}
}
}
}
}
fragment VideoFragment on Video {
videoHTML
}
fragment PhotoFragment on Photo {
url(size:10)
}
Any help appreciated!!
Upvotes: 4
Views: 2950
Reputation: 343
I got it working by adding it in strings.xml as below. make sure there are NO extra spaces.
<string name="graphiql_detail_search">
{
user(ident: "JohnDoe") {
myStory {
description
placements(first: 3) {
edges {
node {
mediaItemType
mediaItem {
...VideoFragment
...PhotoFragment
}
}
}
}
}
}
}
fragment VideoFragment on Video {
videoHTML
}
fragment PhotoFragment on Photo {
url(size: 10)
}
Upvotes: 1
Reputation: 7959
This likely depends on the server implementation of GraphQL. GraphQL does not define the medium, which leaves this question as being somewhat broad. Since express-graphql is so common, I'll make a guess that you may be using that. If that's true, you can query it over HTTP with more details outlined on the documentation for that project. If that happens to not be the case, you'll need to do some more digging.
Upvotes: 1