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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

DataSource.Error : Web.Contents failed to get contents from « https://XXXXXXXXX » (500)

Hi,

 

I get data from an API through a connector. 

It works well except for some inputs which return the following error : 

DataSource.Error : Web.Contents failed to get contents from « https://XXXXXXXXX » (500) : Internal Server Error

I know that these inputs do have data to be returned (those who don't have data still return an empty table). 

 

Do you have any advice on how to solve this ? 

 

Thanks in advance. 

1 ACCEPTED SOLUTION
4 REPLIES 4
faoduonii
New Member

I know this has been marked as solved but what worked for me was simply removing the percentage from the Sharepoint File's name

SofBL
Advocate I
Advocate I

I even expirienced this when my authentication header was not in the right order. 

 

It is always adviced to contact the support team of the API you are trying to connect. 

Secondly first try to connect to the api using Postman, if that works you know you have the right header and possible body in place

good example of a platform that takes care and delivers support on their API is mediavalet. You can refer to your api supplier to their website to show how good api documentation looks like. They also deliver an app collection for postman so you know exactly how the api should work. 
MediaValet API


now for that specific solution this is the way to go: 
I expirenced that if you do this the application/json content type is changed to application/x-www-form-urlencoded by power bi

let
TokenReq = Web.Contents("https://login.mediavalet.com/connect/token", [
Headers = [
#"Content-Type" = "application/x-www-form-urlencoded",
Authorization = Base64cred
],
Content = Text.ToBinary("grant_type=password&username="& Usr & "&password=" & Passw & "&scope=api")
]),
TokenJson = Json.Document(TokenReq),
Token = TokenJson[access_token],
Token2 = Token,
SearchReq = Web.Contents("https://api.mediavalet.com", [
RelativePath = "assets/search",
Headers = [
#"Ocp-Apim-Subscription-Key"= SubscriptionKey,
#"Content-Type" = "application/x-www-form-urlencoded",
Authorization = "Bearer " & Token
],
Content = Json.FromValue([
search = "PietjePuk",
count = 1,
offset = 0,
sort = "record.createdAt D",
searchFields = "attributes",
includeSoftDeleted = true,
filters = "DateUploaded GE 2025-02-22T01:55:39.496Z"
])
]),
Jsonresult = Json.Document(SearchReq)

in
Jsonresult




v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

I suggest that you first test the availability of the API directly using one of the other tools. For example, postman. Make sure the headers information is correct. It may be that some of your headers are missing, such as connect-type or User-Agent.

 

500 statu code is mostly the server encountered an unexpected condition that prevented it from fulfilling the request.

500 Internal Server Error - HTTP | MDN (mozilla.org)

 

 

Best Regards

Community Support Team _ chenwu 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
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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