Forum Discussion
Anonymous
8 years agoNot applicable
API calls with Pagination
I almost see the light at the end of the tunnel. I am able to make a connection through an API call to my data source (Okta in this case) and was very excite until I looked at the data and notice...
Anonymous
8 years agoNot applicable
Good Morning,
Anonymous
I've got it partially working (Its intersting since i have to embed the api key in the url, which Ibelieve I got it working, but instead of getting 100 results, i know have 0, any thoughts?
let
iterations = 10, // Number of iterations
url =
"https://xxxxxxxxxxxxx.okta.com/api/v1/logs, [Headers=[Authorization=""SSWS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"", ContentType=""application/json""]]",
FnGetOnePage =
(url) as record =>
let
Source = Json.Document(Web.Contents(url)),
data = try Source[data] otherwise null,
next = try Source[paging][next] otherwise null,
res = [Data=data, Next=next]
in
res,
GeneratedList =
List.Generate(
()=>[i=0, res = FnGetOnePage(url)],
each [i]<iterations and [res][Data]<>null,
each [i=[i]+1, res = FnGetOnePage([res][Next])],
each [res][Data])
in
GeneratedList
Anonymous
5 years agoNot applicable
Friend, I just put "URL=https:xxxx" without "Headers" and "Content-Type" and it works!
Maybe
Source = Json.Document(Web.Contents(url))
already solves about json