Power BI M code help

Hi
Can anyone have a look at this, I have connected Power Bi to HS, however all tge contacts atre not uploadeing, have I reached a request Limit?
let
    accessToken = “My Token”,
    GetPages = (queryParams as record) =>
        let
            Host = “api.hubapi.com”,
            Source = Json.Document(
                Web.Contents(
                    “https://” & Host,
                    [
                        RelativePath = “crm/v3/objects/contacts”,
                        Query = queryParams,
                        Headers = [
                            #“Content-Type” = “application/json”,
                            Authorization = "Bearer " & accessToken
                        ]
                    ]
                )
            ),
            Results = Source[results],
            NextAfter = if Record.HasFields(Source, “paging”) and Record.HasFields(Source[paging], “next”) and Record.HasFields(Source[paging][next], “after”) then
                            Source[paging][next][after]
                        else
                            null,
            CleanQuery = Record.RemoveFields(queryParams, {“after”}, MissingField.Ignore),
            NextQuery = if NextAfter <> null then
                            Record.AddField(CleanQuery, “after”, NextAfter)
                        else
                            null,
            MoreResults = if NextQuery <> null then
                              @GetPages(NextQuery)
                          else
                              {},
            Combined = List.Combine({Results, MoreResults})
        in
            Combined,
    Fullset = GetPages([
        limit = “100”,
        properties = {“hubspot_owner_id”, “firstname”, “lastname”, “company”, “email”, “twc_champion”, “location___region”,“location___region_dropdown”}
    ]),
    ContactsTable = Table.FromRecords(Fullset),

Hi @SBhatti ,

Thank you for reaching out to the Community!

I’d like to invite some community members who are subject matter experts to join this conversation.

@johnelmer @GRajput @webdew - Would you be able to share any insights on this? Your expertise would be greatly appreciated.

Best regards,

Hi @SBhatti ! To help resolve this issue, could you please share the specific error message you’re seeing or describe what’s happening on your screen? Screenshots would also be very helpful if you’re able to provide them.

This information will help us provide you with the most accurate solution. Thank you!

Hi

There is no error message, the issue is that not all the cotacts are migrated from HS to Power Bi

Hi @SBhatti ,

Looking at your M code, the issue is likely related to rate limiting or pagination handling when retrieving all your contacts. Here are a couple of solutions that should resolve this:

Option 1: HubSpot’s Official Power BI Connector This is available in the HubSpot App Marketplace and handles rate limiting, pagination, and automated data refresh automatically. You can find more details about this solution here: https://community.hubspot.com/t5/APIs-Integrations/Hubspot-to-Power-BI-integration/m-p/1026480#M75823

Option 2: Third-Party Integration Tools There are several robust connectors specifically designed for HubSpot-Power BI integration, with built-in templates and proper API management. You can see the discussion and recommendations here: https://community.hubspot.com/t5/APIs-Integrations/Integrating-Hubspot-to-Power-Bi/m-p/1070955/highlight/true#M78317

These connector solutions are purpose-built to handle API limitations and will save you troubleshooting time while ensuring all your contacts are retrieved properly.

Let us know which direction you’d like to go or if you need more specific guidance on either of these options!

Best,

Victor