Forum Discussion

abhigna's avatar
abhigna
New Member
3 years ago

API iteration and scheduled refresh

Hi,

 

I have very basic understanding of M and I use data from an API for my report and this requires Iteration. The report refreshes on desktop but I  see an error " Some data sources may not be listed because of hand-authored queries" in data source settings and on report server the data sources option is greyed out and I cannot schedule a refresh.

 

The code snippet for the API call is

 

let

FnGetOnePage =
(url1) as record =>
let
Source = Json.Document(Web.Contents(url1, [Headers=[Accept="application/json", #"Content-        Type"="application/json", Authorization="Bearer "&APIToken],Content=Text.ToBinary(Body)])),
data = try Source{0}[results] otherwise null,
next = try Source{0}[next] otherwise null,
next_offset = try Source{0}[next_offset] otherwise null,
res = [Data=data, Next=next, Offset=next_offset]
in
res,

GeneratedList =
List.Generate(
()=>[res = FnGetOnePage(URL&"?limit="&RowLimit)],
each [res][Data]<>null,
each [res = FnGetOnePage([res][Next])],
each [res][Data]),

 

CombinedList = List.Combine(GeneratedList),

I tried a couple of fixes without success. Is there a workaround for this?

 

Thank you!

1 Reply