Using dynamic arguments in Connectors - The Weekly Wisdom - Edition #8

:graduation_cap: Welcome to The Weekly Wisdom

:spiral_calendar: Edition #8 - 26 Jun 2025
:label: Topic tags - Connectors odyssey
:bell: Stay in the loop: Subscribe to the “The Weekly Wisdom” category to get notified when new posts drop—no FOMO here.


Hey all! :waving_hand: @Michelle_Mabuyo here from the Apollo Education team. I’m a Developer Educator and I build courses for Odyssey, our official learning platform.

I’m back for the next edition of a multi-part series to teach you the basics of Apollo Connectors: a powerful way to bring existing REST APIs into your graph, all through configuration in the schema.

:light_bulb:This week’s learning: Using dynamic arguments in Connectors

Need to fetch data based on an argument like an id? You can do that with the special $args object and some curly braces:

type Query {
  listing(id: ID!): Listing
     @connect(
       source: "listings"
       http: { GET: "/listings/{$args.id}" }
       selection: """
       id
       title
       numOfBeds
       costPerNight
       closedForBooking: closedForBookings
       """
     )
}

What’s happening in line 5?

  • $args has access to all the arguments for the Query.listing field. In this case, it just has one argument: id.

  • The endpoint we’re sending the request to is GET /listings/:id. We’re interpolating the $args.id value using curly braces { }.

  • Watch out for the syntax here (especially JavaScript devs!): the dollar sign ($) is inside the curly braces.

You can use $args in any part of your http configuration—URLs, headers, query params—to build dynamic requests from your schema.


:magnifying_glass_tilted_right: Want to go deeper?

We dive into this topic in the Odyssey tutorial “GraphQL meets REST with Apollo Connectors” Lesson 7.

Check out a common Connector pattern for using $args and pagination in the Apollo documentation.

Take the course


:speech_balloon: Share your thoughts in the thread below :down_arrow:

Have you used arguments in your Connectors yet? How did it go?