APIs & Integrations

SClark444
Member

Inconsistent Data Retrieval With New Company Field

SOLVE

Hey everyone,

We’ve been facing a puzzling issue with HubSpot API recently. A new filed (let’s call it XYZ) has been added to the company object, and we using the ‘companies/search’ endpoint to filter companies based on this field. However, we’re encountering a hit-and-miss scenario.

Our cron job checks if a company exists by filtering with XYZ, and if not, it adds the new company to HubSpot. The problem is that in some cases, the search doesn’t return existing company/data. Consequently, the process adds a new company, creating a duplicate. Strangely, when we query for the same company afterward, we end up with two companies sharing the same XYZ.

Has anyone else experienced a similar issue or have insights into why this might be happening? Your help is much appreciated!

1 Accepted solution
ASmith75
Solution
Participant

Inconsistent Data Retrieval With New Company Field

SOLVE

We had tested this in our sandbox environment without issue. We had a LOT of records manually imported and the API process is not returning results based on the custom property field when queried. I am not sure what we are missing. 

data '{
  "filterGroups": [
    {
      "filters": [
        {
          "propertyName": "fein",
          "operator": "EQ",
          "value": "123456789"
        }
      ]
    }
  ],
  "properties": [
    "name", "fein", "status"
  ]

}

View solution in original post

3 Replies 3
ASmith75
Solution
Participant

Inconsistent Data Retrieval With New Company Field

SOLVE

We had tested this in our sandbox environment without issue. We had a LOT of records manually imported and the API process is not returning results based on the custom property field when queried. I am not sure what we are missing. 

data '{
  "filterGroups": [
    {
      "filters": [
        {
          "propertyName": "fein",
          "operator": "EQ",
          "value": "123456789"
        }
      ]
    }
  ],
  "properties": [
    "name", "fein", "status"
  ]

}

Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Inconsistent Data Retrieval With New Company Field

SOLVE

Hey @SClark444 

 

Piggybacking on @FTrands response, the search endpoint might not be your best bet, and could even run into more issues at scale. Rather than using the search endpoint I would suggest using the GraphQL endpoint, filtering using filter: {XYZ__null: false}.

 

If you have any other questions please don't hesitate to reach out!

 

Best

Kevin-C

0 Upvotes
FTrands
Member

Inconsistent Data Retrieval With New Company Field

SOLVE

You're encountering an inconsistency issue with the HubSpot API, particularly with the 'companies/search' endpoint, after adding a new field (XYZ) to the company object. The problem occurs when using your cron job to filter companies based on this field. Occasionally, the search fails to return existing company data, leading to the unintended creation of duplicate companies when your process adds new entries. Subsequent queries reveal two companies sharing the same XYZ field. To address this, it's recommended to review and ensure the correctness of your API calls, investigate edge cases causing inconsistencies, implement a retry mechanism in your cron job, and establish comprehensive logging for monitoring. If issues persist, reaching out to HubSpot support with detailed information could provide further insights or assistance in resolving the problem.

0 Upvotes