Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DevinL
Frequent Visitor

Looping through URL fabric pipeline

Background: I've pulled all account information from a REST API using a data pipeline and stored it in a datalake table called "Accounts".  I now want to pull debit transaction information for each id in the Accounts table and store the data in a new datalake table called "Debits".  The URL that I would need to use is something like: //mysource.com/api/accounts/{id}/transactions/debits/   

The API doesn't have an option to pull all debits at once, but requires you to replace the {id} with the individual ID's that are now in my Source_Accounts table in the id column.

How does someone go about automating this in Microsoft Fabric?

2 ACCEPTED SOLUTIONS
v-cboorla-msft
Community Support
Community Support

Hi @DevinL 

 

Thanks for using Microsoft Fabric Community.

I have tried to repro the scenario. Please find the screenshot for reference.

Sample rest API - reqres.in/api/users?page=2

Data in Lakehouse.

vcboorlamsft_0-1715706466461.png

Pipeline configuration:

vcboorlamsft_1-1715706606919.png

vcboorlamsft_3-1715706670814.png

Output:

vcboorlamsft_4-1715706833650.png

Try to use the below mentioned code in pipeline expression builder

//mysource.com/api/accounts/@variables('id')/transactions/debits/ 

 If the issue still persists, please do let us know. Glad to help.

 

I hope this information helps.

 

Thank you.

View solution in original post

Hi @DevinL 

 

You can set the value - id to variable cust_id using set variable activity.

vcboorlamsft_0-1715856353232.png

You can use this variable cust_id in between your relative URL, in order to generate the URL dynamically.

vcboorlamsft_1-1715856362233.png

Note : I just use the dummy relative URL in place of that you can replace with actual URL accordingly.

 

I hope this information helps. Please do let me know in case of any further queries.

 

Thank you.

View solution in original post

7 REPLIES 7
v-cboorla-msft
Community Support
Community Support

Hi @DevinL 

 

Thanks for using Microsoft Fabric Community.

I have tried to repro the scenario. Please find the screenshot for reference.

Sample rest API - reqres.in/api/users?page=2

Data in Lakehouse.

vcboorlamsft_0-1715706466461.png

Pipeline configuration:

vcboorlamsft_1-1715706606919.png

vcboorlamsft_3-1715706670814.png

Output:

vcboorlamsft_4-1715706833650.png

Try to use the below mentioned code in pipeline expression builder

//mysource.com/api/accounts/@variables('id')/transactions/debits/ 

 If the issue still persists, please do let us know. Glad to help.

 

I hope this information helps.

 

Thank you.

Thank you for your response!

I've tried to follow your steps but unfortunately there isn't an option to query when selecting a DataLake.  I tried doing "Dynamic Content" with "select id from mytablename" and it throws an error stating that my table doesn't exist.

I can select the table's name in a dropdown, but I'm unsure how to only pass the column I need into the ForEach.

Thanks again for taking the time to help me out!

Hi @DevinL 

 

Could you please try to connect your Lakehouse using SQL Endpoint string. 

Please follow the below steps.

Copy the SQL connection string for SQL analytics endpoint.

vcboorlamsft_0-1715754023906.png

Choose a data source as Azure SQL database and connect using the SQL connection string.

vcboorlamsft_2-1715754108243.png

Now you were able to Query the table.

vcboorlamsft_4-1715754127477.png

I hope this information helps. Please do let us know if you have any further queries.

 

Thank you.

Thank you again, cboorla.

I'm able to query fine now and the correct values are being passed from the lookup to the ForEach.

I'm unclear at this point what should be in the Set variable 1 within the ForEach. Also, I'm guessing that within the ForEach is where I would put my REST API pull with the variables('id') in the address.  I guess I'm confused on how to place the lookup value into the variable('id').

Hi @DevinL 

 

You can set the value - id to variable cust_id using set variable activity.

vcboorlamsft_0-1715856353232.png

You can use this variable cust_id in between your relative URL, in order to generate the URL dynamically.

vcboorlamsft_1-1715856362233.png

Note : I just use the dummy relative URL in place of that you can replace with actual URL accordingly.

 

I hope this information helps. Please do let me know in case of any further queries.

 

Thank you.

@v-cboorla-msft  I've tried using the Web Activity and I get a 404 error. I also tried doing a Copy Data and used the same address //address.com/api/v1/accounts/@variables('cust_id')/transactions/debits   and again got a 404 error.

It doesn't show it on the web activity error details, but it does on the copy data details that the variable part of the address is not being replaced.

 

The error shows the address as:
//address.com/api/v1/accounts/@variables('cust_id')/transactions/debits   


When it should show as:
//address.com/api/v1/accounts/1234/transactions/debits  

Thank you! I greatly appreciate your help!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayFBCUpdateCarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.