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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
uma_mahi
Frequent Visitor

Access Token - Client Credentials - Power BI - Connecting API

Hi Team ,
Can you please help me how to pass the below query in Power Query and Is it possible to pass the below request in Power BI? Is there any tutorial which explains about the API and how it works with Power BI? Please guide me on this.
access_token_response
= requests.post('https://api.xxx.com/auth/connect/token',
                                      headers={'Content-type': 'application/x-www-form-urlencoded'},
                                      data={ 'client_id': '1232cd11-7862-1111-83c2-28f5a0b6ce0a', 'client_secret': 'QopQopQop133111', 'grant_type': 'client_credentials', })
access_token = access_token_response.json().get('access_token')
print("Access Token", access_token)
accounts_response = requests.get('https://web-api.xxx.com/enterprise/v1/accounts',
                                 headers={ "Accept": "application/json", "Authorization": f'Bearer {access_token}' })
Thanks!
1 REPLY 1
Anonymous
Not applicable

Hi @uma_mahi 

Based on your code,  you can use web.content connector and you can refer to the following link.

Solved: Connect API with expiring bearer token - Microsoft Fabric Community

Solved: Connect to a Web Service sending parameters - Microsoft Fabric Community

Solved: Channel Advisor API Connection with auth key creat... - Microsoft Fabric Community

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors