Forum Discussion

dinoscool3's avatar
dinoscool3
Icon for Helper II rankHelper II
4 years ago

Anonymous Credintials when credentials are in query

I have a connection to some data on a forum. The credntials to connection (username, API) are in the query that I'm using, and then I connect using annonymous credentials.

 

This works fine on Desktop. However, on the web version and in dataflows it won't save properly. It only saves the credentials dataflow by dataflow, so I can't copy a dataflow easily. And I can't set up automatic refresh from the desktop connector.

 

How can I connect once without having to connect again and again and allow for automatic updates, its very tedious

 

An example of my query is here:

 

= (queryID) => let
        resultCount = 1000,
        otherNameForPage = 0,

        GetPage = (otherNameForPage) =>
            let
                content1 = "params={""page"":""" & Number.ToText(otherNameForPage) & """}",
                RawData = Json.Document(Web.Contents(
                    "https://test.com/admin/plugins/explorer/queries",
                    [RelativePath=Number.ToText(queryID) & "/run",
                        Query=
                        [
                            params="{""page"":""" & Number.ToText(otherNameForPage) & """}"
                        ],

                        Headers = [ 
                        #"api-username"="XXX",
                        #"api-key"="XXX",
                        #"Content-Type" = "application/x-www-form-urlencoded"],
                        Content = Text.ToBinary(content1)
                    ]
                    
                ) ),
                resultCount = RawData[result_count]
            in
                if RawData[result_count] = 0 then null else RawData,
            Pages = List.Generate(
                () => [i = 0, RawData = GetPage(i)],
                each [RawData] <> null,
                each [i=[i]+1, RawData = GetPage(i)],
                each Table.Combine(let raw = [RawData] in List.Transform(raw[rows], each Table.FromRows({_}, raw[columns])))),
            Output = Table.Combine(Pages)
in
    Output

1 Reply