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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.