Skip to main content

Power BI

New

Get data from API with authentication token

Vote (81) Share
Ben's profile image

Ben on 25 Jan 2016 21:29:37

As of yet, Power BI can not query an API that uses authentication via a token added to the HTTP header. While this works when used in Power BI Desktop, the query crashes after uploading to powerbi.com.

Comments (7)
Ben's profile image Profile Picture

879170cf 37b0-4ed5-8d61-1f127f0fe7b2 on 05 Jul 2020 23:22:43

RE: Get data from API with authentication token

ZappySys has released Drivers for REST API (JSON / XML / SOAP). Using these drivers you can connect to virtually any API service in Power BI. It comes with many advanced options such as OAuth Token, Pagination, Error Handling , Query Editor and many more. See below links.

https://zappysys.com/blog/howto-import-json-rest-api-power-bi/
https://zappysys.com/blog/call-soap-api-power-bi-read-xml-web-service-data/

Hope this helps!

Ben's profile image Profile Picture

a3309361 99be-ea11-a812-000d3a8ddfb2 on 05 Jul 2020 22:54:33

RE: Get data from API with authentication token

yes please

Ben's profile image Profile Picture

3f98f71b 9d33-4ed7-a3f7-ad7d5f828c64 on 05 Jul 2020 22:32:03

RE: Get data from API with authentication token

yes please... this is a big issue for us...

Ben's profile image Profile Picture

1bebb818 8efb-4df4-9a6c-0dd1428566a4 on 05 Jul 2020 22:31:30

RE: Get data from API with authentication token

'I'm having the same troubles. It works in power bi desktop, but I cannot set up auto refresh in power bi service. Data are extracted as follows:

= Web.Contents("https://app.idoklad.cz/developer/api/IssuedInvoices?PageSize=1000000&Page=1",[Headers=[#"SecureToken" = "",#"X-App" = "iSmart",#"X-App-Version" = "1.0"]])

Ben's profile image Profile Picture

62ee94a8 55e6-42d8-a4f3-55a7eb969b89 on 05 Jul 2020 22:25:42

RE: Get data from API with authentication token

We also have similar requirements. This works in Desktop but fails after publishing. Error response as follows:

Failed to update data source credentials: The credentials you provided for the data source are invalid. Please check the credentials for all the data sources.Hide details
Activity ID: b0a09f25-d32b-4160-a504-8493c112f67c
Request ID: f7a8849d-ae32-3818-fb90-832d9f58d3f9
Status code: 400
Time: Thu Jul 14 2016 00:43:58 GMT-0700 (Pacific Daylight Time)
Version: 13.0.1500.395
Cluster URI: https://wabi-west-us-redirect.analysis.windows.net
Details: The credentials provided for the Web source are invalid. (Source at https://www13.v1host.com/GettyImagesEnterprise/rest-1.v1/Hist/Story.)

Ben's profile image Profile Picture

Jayati Pathak on 05 Jul 2020 22:25:39

RE: Get data from API with authentication token

PowerBI team,
Has this issue been fixed with the latest version of PowerBI?
Waiting for your response.

Thanks

Ben's profile image Profile Picture

e8e02c3d b6af-450f-ba2f-b6391f89fd95 on 05 Jul 2020 22:17:41

RE: Get data from API with authentication token

we have similar requirement. Following are the details.

Details:
Data base and web server has hosted outside Azure. Have Client_ID and Client_Secret details.

Resource URL
https://app1pub.xxx.net/dev/v1/servicelocation
Method
GET
HTTP Header
Authorization: Bearer [ACCESS_TOKEN]
Note: [ACCESS_TOKEN] being the access token received during one of the authentication calls
Result
[ {"serviceLocationId": 1, name: "Home"},
{"serviceLocationId": 2, name: "Beach resort"}]