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
shreyag12
Regular Visitor

Data Source Error Web Contents failed to fetch data from web api(AWS AppSync Graphql API)

power_bi_issue.PNGHi,
I am trying to fetch data from AWS AppSync Graphql API in power BI . Providing these in headers [Headers=[#"Content-Type"="application/json", #"x-api-key"="xyz"]]

let
    qContent = "
    {
         query MyQuery {
                get_id{
                    id
                 }
            }
    }",
    cContent = Text.Replace(qContent, Character.FromNumber(34), Character.FromNumber(92) &  Character.FromNumber(34)),
    pContent = "{ ""query"": "& Character.FromNumber(34) & cContent & Character.FromNumber(34) & " }",
    bContent = Text.ToBinary(pContent),
    Source = Json.Document(Web.Contents("https://qeenqrsrivdvfnodt4w2ptgt3y.appsync-api.us-east-1.amazonaws.com/graphql", [Headers=[#"Content-Type"="application/json", #"x-api-key"="xyz"],Content=bContent])),
    data = Source[data],
    get_id = data[get_id],
    #"Converted to Table" = Table.FromList(get_id, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id"}, {"id"})
in
    #"Expanded Column1"
The same api url and api key works in Postman but in power bi , I get 
DataSource.Error: Web.Contents failed to get contents from 'https://qeenqrsrivdvfnodt4w2ptgt3y.appsync-api.us-east-1.amazonaws.com/graphql' (400):
I am using Anonymous Type for credentials.
Does anyone has any idea about this issue?


3 REPLIES 3
Ehren
Microsoft Employee
Microsoft Employee

Have you tried comparing the requests being sent to the endpoint in Postman vs. PBIDesktop using a tool like Fiddler? There must be a difference that's causing the 400 error.

Anonymous
Not applicable

Hi @shreyag12 ,

 

I found some similar posts which might be helpful to you:

DataSource.Error: Web.Contents failed to get contents from (400): Bad Request

Post API Data Source body format issues

Azure Cost Management - RI Usage Details - 400 Bad Request

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous Thanks for shaing! 
I tried changing bContent = Text.ToBinary(pContent), to bContent = Json.FromValue(pContent) as mentioned in Post API Data Source body format issues but still getting the same error.

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.