Forum Discussion
Ingest data form a rest API with Oauth2
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.
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 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.
- ThangN2 years agoNew Member
Hi Everyone, I can't seem to get this working myself did others get it working? I've configued as per below and the Login bit seems fine. I
The output I am getting from the login doesnt look like the output the previous post has.
I then subsequently get the 401.
- PhilippM2 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!
- mkj121310 months agoHelper II
Hello, i can see in your first web activity, youa re still hardcoding the email and password. Is there any way to avoid doing that.