0
0
GraphQLquery~10 mins

Subscription lifecycle 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 start a subscription for a user.

GraphQL
mutation StartSubscription { startSubscription(userId: [1]) { id status } }
Drag options to blanks, or click blank then click option'
AuserId
B12345
C"12345"
DsubscriptionId
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unquoted number for userId causes syntax errors.
Using variable names instead of actual values.
2fill in blank
medium

Complete the code to query the subscription status.

GraphQL
query GetSubscriptionStatus { subscription(id: [1]) { status } }
Drag options to blanks, or click blank then click option'
A"sub_001"
B123
Cstatus
DuserId
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted IDs causes errors.
Confusing field names with ID values.
3fill in blank
hard

Fix the error in the mutation to cancel a subscription.

GraphQL
mutation CancelSubscription { cancelSubscription(id: [1]) { id status } }
Drag options to blanks, or click blank then click option'
A"sub_123"
Bid
CsubscriptionId
Dsub_123
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes around string IDs.
Using variable names instead of actual values.
4fill in blank
hard

Fill both blanks to query active subscriptions for a user.

GraphQL
query ActiveSubscriptions { user(id: [1]) { subscriptions(status: [2]) { id } } }
Drag options to blanks, or click blank then click option'
A"user_789"
B"active"
C"inactive"
DuserId
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted strings for IDs or status.
Using wrong status values.
5fill in blank
hard

Fill all three blanks to update subscription status with a mutation.

GraphQL
mutation UpdateSubscription { updateSubscription(id: [1], status: [2]) { id [3] } }
Drag options to blanks, or click blank then click option'
A"sub_456"
B"paused"
Cstatus
DuserId
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting string arguments.
Returning wrong fields in the response.