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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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

 

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.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.