Forum Discussion

michael_mcclari's avatar
michael_mcclari
Regular Visitor
8 years ago

unable to authenticate invoked function

Hi, I am unable to authenticate when trying to invoke a function. See my code below:

 

 

(page as number) as table =>
let
    Source = Web.Page(Web.Contents("https://mycompany.atlassian.net/rest/api/2/search?jql=created%20%3E%20startOfMonth()&maxResults=100&startAt=" & Number.ToText(page) & "00")),
    Data1 = Source{1}[Data],
    RemoveBottom = Table.RemoveLastN(Data1,3)
in
    Data1

I have tried clearing credentials under Data Source Setting. 

 

The strange thing is that when trying to invoke this function from a custom query, I call this query and it works fine in there. See code below:

let
    url = "https://mycompany.atlassian.net/rest/api/2/search?jql=created%20%3E%20startOfMonth()&maxResults=100",
    query = Json.Document(Web.Contents(url)),
    total = query[total],
    maxResults = query[maxResults],
    N = total / maxResults,
    M = Number.RoundDown(N),

    Source = {1..M},
    ToTable = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    Renamed = Table.RenameColumns(ToTable,{{"Column1", "Page"}}),
    Added = Table.AddColumn(Renamed, "Custom", each GetData([Page]))
in
    Added

Everything returns correctly all the way until "Added". Seems there is a special way to do basic authentication when calling from a function.

 

Please help.

 

No RepliesBe the first to reply