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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

API request to get Access token

Hello All,

 

I am having trouble getting an access token using an API Post method in API, can some one please help me to convert the below mentioned cURL to Power BI compatible query ?

 

curl -i -X POST \
-H "Content-Type:application/x-www-form-urlencoded" \
-H "Authorization:Basic AbcDewsgR" \
'https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials'

 

 

Thank you

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , refer if these can help

https://docs.microsoft.com/en-us/power-bi/developer/automation/walkthrough-push-data-get-token

https://www.sqlshack.com/how-to-access-power-bi-rest-apis-programmatically/

https://www.youtube.com/watch?v=f7HLyiAk-lQ

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak ,

 

I guess I wasn't clear on my request, I am trying to create an API POST request to get Access Token from brightcove API so that I can use this token to make an GET request using the token received from the above POST API call. Attached is the screenshot of the POST request for your reference. Can you please let me know how do I do this in Power BI ?

 

cURL code for the below request is :

 

curl -i -X POST \
-H "Content-Type:application/x-www-form-urlencoded" \
-H "Authorization:Basic AbcdfRtwSrte" \
'https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials'

 

I tried to convert the above cURL and below is the query but this gives me an error,

let
Source = Json.Document(Web.Contents(
"https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials",
[
Query=[grant_type="client_credentials"],
Headers=[#"Content-Type" = "application/x-www-form-urlencoded", #"Authorization" = "Basic AbcdfRtwSrte"]

])),

items=Source[items]
in
items

Error Message :

DataSource.Error: Web.Contents failed to get contents from 'https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials' (404): Not Found
Details:
DataSourceKind=Web
DataSourcePath=https://oauth.brightcove.com/v4/access_token
Url=https://oauth.brightcove.com/v4/access_token?grant_type=client_credentials

 

 

2020-08-26_14-59-18.jpg

Hi @Anonymous ,

 

Try to modify your query as below:

let
Source = Json.Document(Web.Contents(
"https://oauth.brightcove.com/v4/access_token",
[
Query=[grant_type="client_credentials"],
Headers=[#"Content-Type" = "application/x-www-form-urlencoded", #"Authorization" = "Basic AbcdfRtwSrte"]

])),
items=Source[items]
in
items

 

 
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.