0
0
GraphQLquery~10 mins

Entity references in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to query the name of a user by their ID.

GraphQL
query { user(id: [1]) { name } }
Drag options to blanks, or click blank then click option'
A123
B"123"
CuserId
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unquoted number for the ID
Using a field name instead of a value
2fill in blank
medium

Complete the code to fetch the posts' titles for a user.

GraphQL
query { user(id: "1") { posts { [1] } } }
Drag options to blanks, or click blank then click option'
Adate
Bcontent
Ctitle
Dauthor
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing content instead of title
Selecting author which is a nested object
3fill in blank
hard

Fix the error in the query to get a user's email.

GraphQL
query { user(id: "2") { [1] } }
Drag options to blanks, or click blank then click option'
Aemail
Bcontact
Cmail
DemailAddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using emailAddress which is not defined
Using mail or contact which are incorrect
4fill in blank
hard

Fill both blanks to query a user's posts with their titles and dates.

GraphQL
query { user(id: "3") { posts { [1] [2] } } }
Drag options to blanks, or click blank then click option'
Atitle
Bcontent
Cdate
Dauthor
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing content instead of date
Including author which is a nested object
5fill in blank
hard

Fill all three blanks to query a user's name, email, and their posts' titles.

GraphQL
query { user(id: "4") { [1] [2] posts { [3] } } }
Drag options to blanks, or click blank then click option'
Aname
Bemail
Ctitle
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up email and content fields
Forgetting to include the posts field