This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
When I make this report search request via chrome I get JSON back and when I make the request in my Power BI data connector I get back HTML. The error I get is "Invalid credential" but I can see the data connector login via the server log. even if I just grab the path from Fiddler and drop it into Chrome I get json back. Why would the Power BI Data Connector query bring back HTML?
here's the query:
section SynDNA;
[DataSource.Kind="SynDNA", Publish="SynDNA.Publish"]
shared SynDNA.Feed = Value.ReplaceType(SynDNAImpl, type function (url as Uri.Type) as any);
SynDNAImpl = (url as text) =>
let
Credential = Extension.CurrentCredential(),
CredentialConnectionString = [ UID = Credential[Username], PWD = Credential[Password] ],
login = Record.ToTable(Json.Document(Web.Contents(url & "/api/login/" & CredentialConnectionString[UID] & "/" & CredentialConnectionString[PWD], [ Headers = DefaultRequestHeaders ]))),
FilterLogin = Table.SelectRows(login, each _[Name] = "hash" ),
hash = List.First(Table.Column(FilterLogin, "Value")),
source = Web.Contents(url & "/api/reports/search?auth=" & hash & "&keyword=EXCEL", [ Headers = DefaultRequestHeaders ]),
source = Web.Contents(dump, [ Headers = DefaultRequestHeaders ]),
json = Json.Document(source)
in
json;
DefaultRequestHeaders = [
// #"Content-Type" = "application/json;odata.metadata=minimal",
#"Accept" = "application/json;odata.metadata=minimal", // column name and values only
#"OData-MaxVersion" = "4.0" // we only support v4
];
// Data Source Kind description
SynDNA = [
Authentication = [
UsernamePassword = []
],It's supposed to bring back a list of reports that have the keyword "EXCEL" attached.
Any help would be appreciated.
Figured out that when I pass the API request in chrome or another browser it passes a Cookie as part of the header. In the data connector request that cookie is absent. If I manually add it to the request header it works. But I can't imagine that cookie string is evergreen. What should the Cookie value be in the request header? Or does it just need some/any value?
Hi @Anonymous
There are some threads you could refer to:
Passing Cookie using Web.Contents in PowerBI Desktop
Working with Web Services in Power Query
Best Regards
Maggie
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.