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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PieterS
Frequent Visitor

API POST with Bearer Token

Hi All,

 

I am fairly new to PowerBI and trying to connect to an API to load data into my report.  The API documentation requires a POST request for a bearer token which should then be used when calling the data query endpoint.

 

I need some help on the best way to set this up.  

 

I have attached some screenshots to show what is required and would be grateful for any assistance to get this up and running!

 

Thanks!

 

Screenshot_20210611-102824.png

Screenshot_20210611-102833.png

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @PieterS 

 

You could refer to these links:

powerbi - How do I retrieve a bearer token from a service in Power BI? - Stack Overflow

powerbi - Where do I save token in Power BI web connection? - Stack Overflow

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @PieterS 

 

You could refer to these links:

powerbi - How do I retrieve a bearer token from a service in Power BI? - Stack Overflow

powerbi - Where do I save token in Power BI web connection? - Stack Overflow

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Thansk for your reply!  I managed to get it to work as follows:

 

let
url = "https://data.springboardanalyser.com/token",
GetJson = Web.Contents(url,
[
Headers = [#"Accept"="application/json",
#"Content-Type"="application/x-www-form-urlencoded;charset=UTF-8"],
Content = Text.ToBinary("username=MYUSERNAME&password=MYPASWORD&grant_type=password")
]
),
FormatAsJson = Json.Document(GetJson),

// Gets token from the Json response
AccessToken = FormatAsJson[access_token],
AccessTokenHeader = "bearer " & AccessToken,
GetJsonQuery = Web.Contents("https://data.springboardanalyser.com/api/footfalloutput/historic?StartDate=2019-01-01&endDate=2021-1...",
[
Headers = [#"Authorization"=AccessTokenHeader]
]
),
FormatAsJsonQuery = Json.Document(GetJsonQuery),
#"Converted to Table" = Table.FromList(FormatAsJsonQuery, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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