Forum Discussion
Anderrated
2 years agoFrequent Visitor
Internal server error (500) when connecting to API with Bearer Token
Hi, So I am trying to connect to an API that requires a Bearer token. When I try to simulate in POSTMAN I successfully get the response data I need: Here you can see the different...
Anonymous
2 years agoNot applicable
Hi Anderrated ,
Base on your description and screenshots , you are encountering issues when connected to the API in Power BI Desktop. However, you are able to successfully connect to the API using Postman. The '500 Internal Server Error' typically indicates a server-side issue, could you please check and confirm the following info?
- Ensure the Bearer token used in Power BI is the same as in Postman and the token hasn't expired.
- Make sure all the headers are same in Power BI Desktop as in Postman
- Update the version of your Power BI Desktop to the latest one
In addition, you can refer the following link to connect to API.
Power BI REST API: Step-by-step Guide to Use It
Or create a blank query in Power Query Editor with the following codes:
let
url = "https://example.com/api/endpoint",
headers = [
#"Authorization" = "Bearer YOUR_BEARER_TOKEN",
#"Content-Type" = "application/json"
],
response = Web.Contents(url, [Headers=headers]),
jsonResponse = Json.Document(response)
in
jsonResponse
Best Regards