You can follow these steps to achieve your goal :
- Web Activity Setup:
- Configure your Web activity to call the API and capture the output in JSON format.
- In the Settings tab, set Secure Output to
true
if your API response contains sensitive data.
- Capture Web Activity Output:
- Ensure that the Web activity captures the response in the
@activity('WebActivityName').output
format.
- Ensure that the Web activity captures the response in the
- Foreach Activity Setup:
- Use a Foreach activity to iterate over a list of API endpoints or parameters.
- Within the foreach loop, use the Web activity to make API calls for each iteration.
- Copy Data Activity:
- Inside the foreach loop, after each Web activity, use a Copy Data activity to save the output to ADLS Gen2.
- In the Source tab of the Copy Data activity:
- Select Dataset as
REST
orHTTP
(depending on your API source). - Set the Request body to capture the Web activity output dynamically using the expression:
@activity('WebActivityName').output
- Select Dataset as
- Sink (ADLS Gen2):
- In the Sink tab of the Copy Data activity:
- Select a Blob dataset pointing to your ADLS Gen2.
- Set the File Path dynamically, so that each API response is saved as a unique file in your Blob container. You can use expressions such as:
container/foldername/@{item().parameter}.json
- Ensure that File format is set to JSON.
- In the Sink tab of the Copy Data activity:
- Configure File Path for Multiple Files:
- If you want each API response to be saved as a separate file, dynamically define the filename using the loop variable or a unique identifier in the API response.
- For example, use the iteration index to generate different file names like:
container/foldername/output_@{item().index}.json
- Error Handling (Optional):
- Add error handling within your foreach loop to ensure that failed API calls are captured and do not disrupt the process.