Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
Hi team,
Though this topic is widely discussed on forum and other article describe on how to get data through API pagination calls, I'm finding it very difficult to get it work in my situation.
Below is the M query that im using but it fails at the "GetJson" with error "Expression.Error: The field '@odata.count' of the record wasn't found."
Kindly help me how can i resolve this issue.
BaseUrl = "https://webexapis.com/v1/meetings?meetingType=meeting&from=2019-01-22T04:00:00Z&to=2020-12-31T04:00:...",
Token = "xxxxxxxxx",
EntitiesPerPage = 100,
GetJson = (Url) =>
let
Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
GetEntityCount = () =>
let Url = BaseUrl & "&count=true&top=0",
Json = GetJson(Url),
Count = Json[#"@odata.count"]
in Count,
GetPage = (Index) =>
let Skip = "$skip=" & Text.From(Index * EntitiesPerPage),
Top = "$top=" & Text.From(EntitiesPerPage),
Url = BaseUrl & Skip & "&" & Top,
Json = GetJson(Url),
Value = Json[#"value"]
in Value,
EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }),
PageCount = Number.RoundUp(EntityCount / EntitiesPerPage),
PageIndices = { 0 .. PageCount - 1 },
Pages = List.Transform(PageIndices, each GetPage(_)),
Entities = List.Union(Pages),
Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
Table
Hi @LP2803
The error is telling you that there is no record in the returned JSON with a field name of @odata.count.
What is actually being returned in the JSON? Click on the Json step and you should see what GetJson is returning.
As an example, here's another JSON request I've made to another website.
The returned JSON contains 2 fields called metadata and results. I can access the data in the results field by creating a step like this
res = Json[results]Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 12 | |
| 6 | |
| 5 | |
| 5 | |
| 5 |