<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008C3jZGSAZOkta Classic EngineIntegrationsAnswered2024-08-06T22:44:38.000Z2018-01-22T18:23:45.000Z2020-06-04T17:43:12.000Z
pull out data from multiple web pages (pagination) in power query.
Hi,

 

I am trying to pull out data from multiple web pages of okta api.

 

According to okta api documentation,

 

HTTP/1.1 200 OK

Link: <https://{yourOktaDomain}.com/api/v1/users?after=00ubfjQEMYBLRUWIEDKK (https://%7byourOktaDomain%7d.com/api/v1/users?after=00ubfjQEMYBLRUWIEDKK)>; rel="next",

  <https://{yourOktaDomain}.com/api/v1/users?after=00ub4tTFYKXCCZJSGFKM (https://%7byourOktaDomain%7d.com/api/v1/users?after=00ub4tTFYKXCCZJSGFKM)>; rel="self"

I need to add “rel=next” . I want to know how it can be done in power query.

 

I tried to pass 'rel=next' as option parameter 'Content'. I am getting 0 record.

 

I don't know if my logic is correct or not for cursor based pagination.

 

Here is my query,

 

let

iterations = 10, // Number of iterations

url = "https://xxxx.okta.com/api/v1/logs",

auth_key = "SSWS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

header=[Authorization=auth_key , ContentType="application/json"],

content1 = "{

""rel"":""next"",

}",

 

FnGetOnePage =

(url) as record =>

let

Source = Json.Document(Web.Contents(url, [Headers=header, Content=Text.ToBinary(content1)])),

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

This question is closed.
Loading
pull out data from multiple web pages (pagination) in power query.