Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Sajid02
Helper I
Helper I

API _All Pages data are not coming

Hi Folks , 

Need help on API integration into power BI for all the pages. I am getting stuck on the point that even after changing the M-Code using Function of the query and using list.generate function . It is only giving me initial 100 records only , but not giving pages records .

Steps I tried :- 

1.  Provide API into Web using Advance option

2. After this , passing parameter using Authorization 

3. List came that is converted into function using below M-Code 

(page as number) =>

let
Source = Json.Document(Web.Contents("https://eu.api.knowbe4.com/v1/users", [Headers=[Authorization="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhaWQiOjk3MCwiaWF0IjoxNTE1NjIwNjU0fQ.OWbiEDCK9pEqFSjKId5zQ5SwDt5KROGt_GwIAlJgJRg"]]))

in
Source

4. Then invoking query using below below change in M code to get all pages records 
let
Source = List.Generate(
() => 1,
each _ <=100,
each _ +1),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Invoked Custom Function" = Table.AddColumn(#"Converted to Table", "Dynamic", each Dynamic([Column1])),
#"Expanded Dynamic" = Table.ExpandListColumn(#"Invoked Custom Function", "Dynamic"),
#"Expanded Dynamic1" = Table.ExpandRecordColumn(#"Expanded Dynamic", "Dynamic", {"id", "employee_number", "first_name", "last_name", "job_title", "email", "phish_prone_percentage", "phone_number", "extension", "mobile_phone_number", "location", "division", "manager_name", "manager_email", "provisioning_managed", "provisioning_guid", "groups", "current_risk_score", "aliases", "joined_on", "last_sign_in", "status", "organization", "department", "language", "comment", "employee_start_date", "archived_at", "custom_field_1", "custom_field_2", "custom_field_3", "custom_field_4", "custom_date_1", "custom_date_2"}, {"id", "employee_number", "first_name", "last_name", "job_title", "email", "phish_prone_percentage", "phone_number", "extension", "mobile_phone_number", "location", "division", "manager_name", "manager_email", "provisioning_managed", "provisioning_guid", "groups", "current_risk_score", "aliases", "joined_on", "last_sign_in", "status", "organization", "department", "language", "comment", "employee_start_date", "archived_at", "custom_field_1", "custom_field_2", "custom_field_3", "custom_field_4", "custom_date_1", "custom_date_2"}),
#"Expanded aliases" = Table.ExpandListColumn(#"Expanded Dynamic1", "aliases")
in
#"Expanded aliases"


Problem - After this ,  this code giving me a list of records but it keeps on repeating after every 100 records and continues , not stopping anywhere. 

I need to get data from all the pages of the source which till now have 2700 records almost . but getting only 100 records 

Screenshot :-

Sajid02_0-1692621233584.pngSajid02_1-1692621302374.png

One can check after 100 records , it starts repeating again. Ideally , this should not be and should come with new records of new page .


Please help on this on how it can be sorted out .

Thanks in Advance  




1 REPLY 1
Sajid02
Helper I
Helper I

@amitchandak @GuyInACube - Please help on this 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.