We're giving away 30 tickets for FREE! Share your story, your vision, or your hustle and tell us why YOU deserve a ticket.
Apply nowWin a FREE 3 Day Ticket to FabCon Vienna. Apply now
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 :-
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
User | Count |
---|---|
67 | |
61 | |
47 | |
35 | |
32 |
User | Count |
---|---|
87 | |
72 | |
56 | |
49 | |
45 |