<@U04S8PLJWMT> I’m setting up an API stream in the...
# ask-ai
q
@kapa.ai I’m setting up an API stream in the custom builder. I want to use the partition router to iterate through a list of values from another stream. The key values need to be inserted into the endpoint URL. Is there a way to do this? For example purposes you can use id and event_id as the Parent Key and Current Parent Key Value Identifier
k
Thinking completed Yes, this is exactly what the Substream Partition Router is designed for. Here's how to set it up: Using Substream Partition Router with URL Path Injection Configuration: • Parent Stream: Select the stream that provides the values • Parent Key:
id
(the field from parent records to use) • Partition Field:
event_id
(the identifier you'll reference in the URL) • Request Option: Leave this unset — you'll inject the value directly into the URL path instead URL Path: In your stream's URL path, reference the partition value using `{{ stream_partition.event_id }}`:
Copy code
/events/{{ stream_partition.event_id }}/details
This will cause Airbyte to iterate through each record from the parent stream, extract the
id
field, and make a separate request for each one — e.g.:
Copy code
GET /events/123/details GET /events/456/details GET /events/789/details
YAML Example If you're working in the YAML editor, it looks like this:
Copy code
partition_router:   type: SubstreamPartitionRouter   parent_stream_configs:     - type: ParentStreamConfig       stream: "#/definitions/your_parent_stream"       parent_key: id       partition_field: event_id
And in your requester path:
Copy code
path: "/events/{{ stream_partition.event_id }}/details"
> Important: Use
stream_partition.event_id
(not
stream_slice.event_id
) when referencing the partition value in the URL path. [Partition Router Docs; SubstreamPartitionRouter] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.