Forum Discussion
MylenePBI
2 years agoHelper I
Ingest data form a rest API with Oauth2
Hello, I am trying to ingest data from a rest API using fabric data pipelines, but I am in trouble as oauth2 authentication isn't supported. Is it possible to know when it will be available? I ...
Anonymous
2 years agoNot applicable
Hi MylenePBI - Thanks for using Fabric Community,
As I understand you are trying to copy data from rest api to lakehouse with the help of fabric pipelines.
Current challenge in your case is inorder to invoke rest api you required token ( i.e.
Bearer token).
As per my understanding we can have a work around to achieve your task.
I am having 2 APIs, API_1 will get a token and other API_2 will get result(date) on passing token along with header.
Lets try to use a Web Activity inorder to get token for us. Please find below screenshot.
Step 1: Use Web Activity in Pipeline.
Step 2: Configure the connection with Base URL.
Step 3: Provide the relative URL of the API (API_1).
Step 4: Pass the json value in body (if applicable)
Step 5: Add Header - Content-Type: application/json inorder to communicate body is a JSON format.
As per my understanding we can have a work around to achieve your task.
I am having 2 APIs, API_1 will get a token and other API_2 will get result(date) on passing token along with header.
Lets try to use a Web Activity inorder to get token for us. Please find below screenshot.
Step 1: Use Web Activity in Pipeline.
Step 2: Configure the connection with Base URL.
Step 3: Provide the relative URL of the API (API_1).
Step 4: Pass the json value in body (if applicable)
Step 5: Add Header - Content-Type: application/json inorder to communicate body is a JSON format.
Step 6: Link a Copy Activity to this Web Activity.
Step 7: Creation a Rest API connection with the base URL.
Step 8: Configure connection type and base url (API_2)
Step 9: !Important Configure your header with Authorization: Bearer <token>
Step 10: !Important (inorder to pass token dynamic way, not manually)
Configure value with add dynamic content Bearer @{activity('User_Login_Token').output.data.Token}
Note: .data.Token is as per my json output, you can write your expression based on your json output from API_1.
Hope this is helpful. Please feel free incase of any queries.
PhilippM
2 years agoAdvocate I
You are a genius! It took my some time to adapt it to my REST API, but I got it to work. This is so nice, thank you very much!