This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowThe Fabric community is upgrading! Read all of the details including the timeline and what you can expect. Learn more
I have an API data source that returns 1 record and it uses cursor pagination. But I am new to Power BI and can't figure out how to do a response call to look up the next record and so on if more.
Can someone assist, have tried multiple options but none seem to work
HI @Anonymous ,
I think query paginated should suitable for your requirements. You can check at the following document or write a custom function with an iterator to merge each result and invoke web API with next cursor key:
Sample:
let
GetListByCurrsor=(rootpath as text,apikey as text, size as number,optional _currsor as text, optional resultList as list) as list=>
let
Source=if
_currsor<>null
then
Json.Document(Web.Contents(rootpath&"&"&_currsor,[Header=[#"XXX-Api-Key"=apikey]]))
else
Json.Document(Web.Contents(rootpath,[Header=[#"XXX-Api-Key"=apikey]])),
Result=if
resultList<> null
then
if
List.Count(resultList)<size
then
@GetListByCurrsor(rootpath,apikey,size,Source[currsor], List.Combine({resultList,Source[events]}))
else
resultList
else
@GetListByCurrsor(rootpath,apikey,size,Source[currsor],Source[events])
in
Result
in
GetListByCurrsor
Comment: rootpath is API URL, apikey is the header optional parameter, size is the max size of the result, _cursor is cursor key, resultList is the list store and merge result.
Regards,
Xiaoxin Sheng
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |