Calling a Microsoft Fabric REST API in a Fabric Data Pipeline is straightforward. It involves two main steps: obtaining the access token and using that access token to call the Fabric API. This comprehensive, step-by-step tutorial includes screenshots for easy guidance and as an example we will call Fabric REST API to retrieve list of all notebooks in the workspace . Ensure you have created an App Registration and granted it access to the Fabric Workspace before proceeding. If not, follow our App Registration tutorial first by visiting this link. Create Azure App Registration for Microsoft Fabric
1. Create a new Data Pipeline in Microsoft Fabric. Rename it to your choice.

2. Go to Activities tab and select the Web activity.

3. Give Web activity a suitable name.

4. Go to Settings tab. Under Connection drop down select More option.

5. Select Web v2 option.

6. Put https://login.microsoftonline.com/ as Base Uri and give the new connection a name. Click Connect button.

7. For the remaining fields in Settings, specify the following:
Relative URL: {Tenant ID}/oauth2/v2.0/token
Method: POST
Headers: Content-Type application/x-www-form-urlencoded
Body:
grant_type=client_credentials
&client_id={Client ID}
&client_secret={Client Secret}
&scope=https%3A%2F%2Fapi.fabric.microsoft.com%2F.default
Replace Tenant ID, Client ID and Client Secret with values you copied from Azure App Registration.

8. Run the pipeline and check if we got the access_token in output successfully.

9. Add another Web activity in data pipeline. Connect both the activities. Give the new activity a proper name.

10. In Settings tab of new Web activity, create a new connection with Base Uri as https://api.fabric.microsoft.com/v1/ and give it a proper name.

11. For the remaining fields in Settings, specify the following:
Relative URL: workspaces/{Workspace ID}/notebooks
Method: GET
Headers: Authorization @concat(‘Bearer ‘, activity(‘Get Access Token’).output.access_token)
Replace Workspace ID with Fabric Workspace ID. Whenever we open a workspace, its ID is visible in the URL.
Relative URL is set to get the list of all Notebooks present in the specified Workspace.

12. Finally run the pipeline and check if API has returned the list of Notebooks which are present in our Fabric Workspace.

Integrating Microsoft Fabric REST APIs into your Fabric Data Pipeline can significantly streamline your workflow and improve efficiency. By following the detailed steps provided in this tutorial, from obtaining the access token to making API calls, you can effortlessly manage and access various Fabric resources within your workspace. Ensure your App Registration is correctly set up with the necessary permissions to ensure seamless operation. Stay tuned to our blog for more insightful tutorials and tech tips to enhance your productivity with Microsoft Fabric. Happy coding!