Forum Discussion
Anonymous
4 years agoNot applicable
how to create a M query ( Power Query SDK) to Pull all Page Record
Hi , I would like to connect API using custome connector to pull the all page data in singble table. API I able to pull only 100 record. If I would like to pull remain record using paging . Wha...
lbendlin
Super User
4 years agoThis particular API doesn't have a nextlink navigator, it uses Limit and Offset (skip). Therefore it is better to use List.Generate. Below is a sample implementation.
let
Search = "remdesivir",
Limit = 100,
Rows = Json.Document(Web.Contents("https://api.fda.gov/drug/event.json",[Query = [search = Search]]))[meta][results][total],
Fetch = List.Generate(()=>0, each _ < Rows, each _ + Limit),
#"Converted to Table" = Table.FromList(Fetch, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Json.Document(Web.Contents("https://api.fda.gov/drug/event.json",[Query = [search = Search, limit = Text.From(Limit), skip = Text.From([Column1])]]))[results]),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
#"Expanded Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".