<@U04S8PLJWMT> how do i put the stream name into t...
# replication-ask-ai
b
@kapa.ai how do i put the stream name into the connector builder api endpoint url
k
Based on the knowledge sources, there are a couple of approaches for dynamically setting the API endpoint URL in the Connector Builder. Using Stream Templates (Component Mappings) If you want to generate multiple streams where each stream's endpoint URL is based on data from another API (e.g., a list of repositories), you can use Stream Templates with Component Mappings. For example, to set the URL dynamically per generated stream, you would: 1. Create a Stream Template and configure the Produce Data for Template endpoint. 2. In the Components Mapping section, add a mapping wherehttps//api.github.com/repositories/{{ components_values.id }}/issues ā—¦ Field Path is set to
retriever, requester, url
ā—¦ Value uses the
components_values
variable, e.g.: This pulls a value (like an ID or name) from each record returned by the template's endpoint and injects it into the URL of each generated stream. [Stream Templates] Using stream_partition in the URL (Partitioning) If you're using Parameterized Requests or a Parent Stream, you can reference the partition value directly in the URL path using Jinja expressions and the
stream_partition
variable. For example:
Copy code
https://connect.squareup.com/v2/quotes/{{ stream_partition['id'] }}/quote_line_groups
This is useful when the stream name or a related value needs to be injected into the URL path. [Custom parameter injection; YAML Reference] In summary: You don't inject the stream name itself directly into the URL, but you can inject dynamic values (like IDs or slugs from a parent/template endpoint) using
{{ components_values.<field> }}
in Stream Templates or
{{ stream_partition['<field>'] }}
in partitioned streams. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
b
Something went wrong in the connector. See the logs for more details. Exception while syncing stream Supplier: Jinja macro has undeclared variables: {'components_values'}.
@kapa.ai Something went wrong in the connector. See the logs for more details. Exception while syncing stream Supplier: Jinja macro has undeclared variables: {'components_values'}.
k
The error
Jinja macro has undeclared variables: {'components_values'}
means that
{{ components_values.<field> }}
is being used outside of a Stream Template context, where it is not available.
{{ components_values.field_name }}
is only valid within the Components Mapping section of a Stream Template — it references fields from the records returned by the Produce Data for Template endpoint. [Stream Templates] If your
Supplier
stream is a regular stream (not a generated stream from a Stream Template), you cannot use
{{ components_values.* }}
in it. Here are the likely fixes: 1. If you intended to use a Stream Template: Make sure the stream is configured as a generated stream under a Stream Template, not as a standalone stream. The
components_values
context is only injected into streams generated by a template. 2. If you're trying to inject a dynamic value into the URL from a parent stream: Use
{{ stream_partition['field_name'] }}
instead, which is the correct interpolation context for partitioned/sub-streams. 3. If you're trying to reference a config value: Use
{{ config.field_name }}
instead. The available interpolation contexts outside of Stream Templates are: •
{{ config.field_name }}
— connector configuration values •
{{ stream_slice.field_name }}
— stream slice information •
{{ stream_template_config.field_name }}
— stream template configuration (only in template context) [Advanced configuration] Check where
{{ components_values.* }}
is being used in your
Supplier
stream and replace it with the appropriate interpolation variable for your use case. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
b
@kapa.ai i need the stream name in the url itself
k
The knowledge sources do not explicitly mention a built-in variable that exposes the current stream's own name for use in its URL. However, based on what the knowledge sources do cover, here are your realistic options: Option 1: Use config.field_name If the value you need in the URL is something the user provides at connection setup time, you can reference it via:
Copy code
https://api.example.com/{{ config.supplier_name }}/endpoint
Option 2: Use Stream Templates with components_values If you have multiple streams (e.g., one per supplier) and the supplier name/ID comes from an API response, use a Stream Template. The template fetches a list of items, and each generated stream gets its URL set via a component mapping: • Field Path:
retriever, requester, url
• Value:
https://api.example.com/{{ components_values.name }}/endpoint
This is the correct way to dynamically vary the URL per stream based on data from another endpoint. [Stream Templates] Option 3: Use stream_partition (for partitioned streams) If you're using a parent stream to drive sub-streams, you can inject the partition value into the URL:
Copy code
https://api.example.com/{{ stream_partition['name'] }}/endpoint
[Custom parameter injection] In short: There is no variable like
{{ stream.name }}
available in the interpolation context. You need to either hardcode the value per stream, pull it from
config
, or use Stream Templates / partitioning to inject dynamic values into the URL. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
b
@kapa.ai Exception while syncing stream Supplier: Jinja macro has undeclared variables: {'components_values'}.
k
This is the same error you encountered earlier. To recap the solution: The error
Jinja macro has undeclared variables: {'components_values'}
occurs because
{{ components_values.* }}
is being used in your
Supplier
stream, but this variable is only available within Stream Templates (specifically in the Components Mapping section). [Advanced configuration] To fix it, replace
{{ components_values.* }}
in your
Supplier
stream URL with one of the valid interpolation variables: •
{{ config.field_name }}
— if the value comes from connector configuration •
{{ stream_partition['field_name'] }}
— if the value comes from a parent stream partition •
{{ stream_slice.field_name }}
— for stream slice information For example, if the supplier name is a config value:
Copy code
https://api.example.com/{{ config.supplier_name }}/endpoint
Or if it comes from a parent stream:
Copy code
https://api.example.com/{{ stream_partition['name'] }}/endpoint
If you do need the URL to vary based on data fetched from another API endpoint, you'll need to restructure the
Supplier
stream as a generated stream under a Stream Template, which is the only context where
{{ components_values.* }}
is valid. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
b
@kapa.ai i need "Supplier" in the {{}} of api endpoint url
k
Looking at your screenshot, you want to hardcode the literal string
"Supplier"
(the stream name) into the URL instead of using
{{ components_values.name }}
. The simplest fix is to just hardcode it directly in the URL — no Jinja expression needed:
Copy code
https://{{ config['sap_id'] }}.businessbydesign.cloud.sap/sap/byd/odata/analytics/ds/Supplier.svc/Supplier?$form...
If you want to keep it as a Jinja expression for some reason, you can use
$parameters
to define it once and reference it:
Copy code
$parameters:
  stream_name: "Supplier"
Then in the URL:
Copy code
https://{{ config['sap_id'] }}.businessbydesign.cloud.sap/sap/byd/odata/analytics/ds/{{ parameters.stream_name }}.svc/{{ parameters.stream_name }}?$form...
[String Interpolation] The key point is: there is no built-in variable that automatically exposes the stream's own name. You need to either hardcode it or define it via
$parameters
. The
{{ components_values.name }}
you currently have is causing the error because that variable is only available inside Stream Templates, not in a regular standalone stream like
Supplier
. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.