8. Exercise 3: Listing activities
5m

Exercise 3: A listing's activities ( 5 min)

Uncomment the following lines from the listings.graphql schema:

listings.graphql
type Listing {
# ...other Listing fields
# EXERCISE: LISTING ACTIVITIES
"The activities available for this listing"
activities: [Activity!]!
}
# EXERCISE: LISTING ACTIVITIES
type Activity {
id: ID!
name: String!
description: String
terrain: String
groupSize: Int
}
Task!

Save your changes. rover dev will now give you an error:

error[E029]: Encountered 6 build errors while trying to build a supergraph.
Caused by:
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Listing.activities`. It must have a `@connect` directive or appear in `@connect(selection:)`.
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.id`. It must have a `@connect` directive or appear in `@connect(selection:)`.
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.name`. It must have a `@connect` directive or appear in `@connect(selection:)`.
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.description`. It must have a `@connect` directive or appear in `@connect(selection:)`.
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.terrain`. It must have a `@connect` directive or appear in `@connect(selection:)`.
CONNECTORS_UNRESOLVED_FIELD: [listings] No connector resolves field `Activity.groupSize`. It must have a `@connect` directive or appear in `@connect(selection:)`.

Exercise #3 Goal

🎯 Retrieve data for the Listing.activities .

Use this REST API endpoint:

https://activities-rest-api-0d717e1922e0.herokuapp.com/location/:id/activities

After successfully completing the exercise, you should get data back when running the GetListingActivities below:

GetListingActivities
query GetListingActivities($listingId: ID!) {
listing(id: $listingId) {
id
title
activities {
id
name
description
terrain
groupSize
}
}
}

For the Variables section:

{
"listingId": "listing-1"
}

Check your work

Answer the following questions after you've completed the exercise. Lost? Check out the hints and solution below.

For the listing with id listing-1, which of the following statements about the listing's activities are true?
How many network calls did the GetListingActivities operation make?

Detour: Using Apollo Skills

Apollo Skills give your AI coding assistant the context it needs to build effectively with Apollo.

Skills activate automatically once installed. Your AI agent uses them when relevant tasks are detected. For example, it may help you write , refactor the client code, or determine the correct YAML configuration. Skills are especially useful when you want guidance that follows Apollo conventions while still adapting to the code in your app.

If you have access to Claude or any other AI agent that supports Skills, you can try completing this exercise using that approach instead of manually.

  1. Install Apollo Skills for Connectors and :

    npx skills add https://github.com/apollographql/skills --skill apollo-connectors --agent claude-code
    npx skills add https://github.com/apollographql/skills --skill graphql-schema --agent claude-code
  2. Select the project scope as Project or Global according to your preference.

  3. Proceed with the installation.

  4. Start a new Claude Code session and give it the following prompt:

Use the apollo-connectors skill to update the listings.graphql schema.
Use this REST API endpoint to retrieve activities data using a listing id: https://activities-rest-api-0d717e1922e0.herokuapp.com/location/:id/activities
Success criteria: running the query below with listingId: "listing-1" returns that listing's activities.
query GetListingActivities($listingId: ID!) {
listing(id: $listingId) {
id
title
activities {
id
name
description
terrain
groupSize
}
}
}

💭 Hints (for manual completion)

Solution

listings.graphql
extend schema
# ...other schema extensions
@source(
name: "activities"
http: { baseURL: "https://activities-rest-api-0d717e1922e0.herokuapp.com" }
)
type Listing {
# ...other Listing fields
"The activities available for this listing"
activities: [Activity!]!
@connect(
source: "activities"
http: { GET: "/location/{$this.id}/activities" }
selection: """
id
name
description
terrain
groupSize
"""
)
}
# EXERCISE: LISTING ACTIVITIES
type Activity {
id: ID!
name: String!
description: String
terrain: String
groupSize: Int
}
Previous