Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
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?
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.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |