Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Custom Connector: Navigation table Preview fails for all items except one



I am building a custom connector that exposes data retrieved from several REST endpoints.

I am using Key authentication. Based on the access key provided I am issing bearer token to be used in all subsequent API request. 


When I run the connector in Vusual Studio it works fine, but when I use the connector in Power BI it behaves strange. 

When I enter the requred Key on the first screen Power BI renderes the Entities correctly:



When I click on the Datacenter Table the data is previewed corectly, but when I click all of the other entities looks like something failes and instead of preview I get the authentication screen again:


Same happens in the Power Query editor:


Only one query works, the others say: We could't authenticate 



However if I click cancel and then select this entity and Load the data it loads correctly in Power BI, the refresh works fine. 

I thoght there might be slighit behavior difference when the code is consumed by this Navigator dialog to select which tables to be added in the model. I research a bit how I could debug it but without any luck so far. 

If I return just 

Does someone had similar issue?

Is there a way to see at which point in the chain of steps it fails? Any logs?


Here is the sceleton of my code:


[DataSource.Kind="Connector", Publish="Connector.Publish"]
shared Connector.Contents = () =>
        accessKey = Extension.CurrentCredential()[Key],

        apiServerUrl = Connector.ParseApiServerUrl(accessKey),

        token = Connector.GetAccessToken(apiServerUrl, accessKey),
        dcs = Connector.GetDatacenters(token, apiServerUrl),

        apiKeys = Table.SelectColumns(dcs, {"ApiKey"}),
        dailyActivity = Connector.DailyActivity(token, apiServerUrl, apiKeys),
        personas = Connector.Personas(token, apiServerUrl, apiKeys),
        personaStats = Connector.PersonaStatistics(token, apiServerUrl, apiKeys),

        base = #table(type table [ Name = Text.Type, Data = Table.Type, IsLeaf=Logical.Type ], 
            { "Datacenters", dcs, true },
            { "DailyActivity", dailyActivity, true },
            { "Personas", personas, true },
            { "PersonaStatisitcs", personaStats, true }

        nav = CreateNavTable(base)


Inside the functions that retrieve the data I am doing N API calls by invoking another functioni per each raw in the following way:


Connector.GetStatistics_AllDCs = (token, apiServerUrl, apiKeys, endpoint) => 
        convs = Table.AddColumn(apiKeys, "PerDC", each Connector.GetStatistics(token, apiServerUrl, endpoint, [ApiKey])),
        forAllDCs = Table.ExpandTableColumn(convs, "PerDC", {"Column1"}, {"Column1"}),
        filtered = Table.SelectRows(forAllDCs, each [Column1] <> null)       


The Connector.GetStatistics uses Web.Contents to retrieve the data. 




Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Kudoed Authors