Using Replace Transformation in Connector Builder UI

Summary

The user is inquiring about using the replace transformation in the Connector Builder UI to extract the ID from a field that contains a full URL from a REST API for later use in a substream.


Question

Hey there, is it possible to use replace for a transformation in the connector builder ui? I’d like to add a transformation that replaces one field that comes from a REST API where the id has the whole url, and within the transformation I’d like to end up only with the ID of the resource to later use it in a substream



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want to access the original thread.

Join the conversation on Slack

["replace-transformation", "connector-builder-ui", "rest-api", "id-extraction", "substream"]

AddField will replace if the key already exists, it might be useful here. <Slack thread> goes into some of the less intuitive behavior around different transformations

If someone finds it useful later on this is the Jinja expression I used.

  1. Take in the original field
  2. Replace the base url/endpoint
  3. Replace path for the resource
    {{ record['iri'] | replace(config['base_url'], '') | replace('/task/', '') }}