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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sugna66
Frequent Visitor

Data Connection search coming back as HTML not JSON

Screen Shot 2019-02-20 at 11.07.38 AM.png

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. 

2 REPLIES 2
sugna66
Frequent Visitor

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 @sugna66 

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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors