APIs & Integrations

devmosaic
Participant

Get all companies - odd offset behaviour

Résolue

I'm getting all my companies using API, but I'm testing how pagination works so I limited my results to 4 and I have 6 companies in total. 

so I do a GET /companies/v2/companies?limit=4 

and then I receive 4 companies with the root info { "has-more": true, "offset": 2403636826 ... }

 

Given that I need to create a new request to get the rest of the companies:

/companies/v2/companies?limit=4&offset=2403636826

 

But I get the error: Unable to parse value for query parameter: offset

 

I think the problem is under the offset type. In order to test I requested with offset=2147483647 (which is the maximum integer32 number) I get results correctly.

But when I request with a integer64 (offset=2147483648 for example) I get the same error of unable to parse offset.

 

How can I make it work?

0 Votes
1 Solution acceptée
Derek_Gervais
Solution
Ancien salarié HubSpot
Ancien salarié HubSpot

Get all companies - odd offset behaviour

Résolue

Hey @devmosaic ,

 

Thanks for the info, that was helpful in identifying the issue. I was able to reproduce the issue you're seeing, but there's a catch: The public "Get all companies" endpoint is `companies/v2/companies/paged`, not `companies/v2/companies`. The `companies/v2/companies` endpoint appears to be an old legacy endpoint that's still live, though undocumented. This issue appears limited only to this legacy `companies/v2/companies` endpoint, not the currently supported `companies/v2/companies/paged` endpoint.

 

I'll be sure to bring this to my team in order to get to the bottom of this issue, but regardless I'd recommend using the publicly documented endpoint (i.e. `companies/v2/companies/paged`) as described in the following developer documentation: https://developers.hubspot.com/docs/methods/companies/get-all-companies

Voir la solution dans l'envoi d'origine

5 Réponses
Derek_Gervais
Ancien salarié HubSpot
Ancien salarié HubSpot

Get all companies - odd offset behaviour

Résolue

Hey @devmosaic ,

 

If you're using the `offset` parameter that's documented in this documentation, the number should be working. Can you give me your Hub ID so that I can dig into this? If it's an issue with the endpoint, I'll want to get this in front of the team asap.

0 Votes
devmosaic
Participant

Get all companies - odd offset behaviour

Résolue

Hey @Derek_Gervais 

I did use the documentation you mentioned. I strongly think the problem might be in Hubspot API's backend.

 

My is HID 6403674

0 Votes
Derek_Gervais
Solution
Ancien salarié HubSpot
Ancien salarié HubSpot

Get all companies - odd offset behaviour

Résolue

Hey @devmosaic ,

 

Thanks for the info, that was helpful in identifying the issue. I was able to reproduce the issue you're seeing, but there's a catch: The public "Get all companies" endpoint is `companies/v2/companies/paged`, not `companies/v2/companies`. The `companies/v2/companies` endpoint appears to be an old legacy endpoint that's still live, though undocumented. This issue appears limited only to this legacy `companies/v2/companies` endpoint, not the currently supported `companies/v2/companies/paged` endpoint.

 

I'll be sure to bring this to my team in order to get to the bottom of this issue, but regardless I'd recommend using the publicly documented endpoint (i.e. `companies/v2/companies/paged`) as described in the following developer documentation: https://developers.hubspot.com/docs/methods/companies/get-all-companies

Kishore
Membre

Get all companies - odd offset behaviour

Résolue

https://legacydocs.hubspot.com/docs/methods/companies/get-all-companies there is max limit only 250, in my companies table i have 3357 records so how to send all these companies records into External application. how to adjust end point please help me

0 Votes
devmosaic
Participant

Get all companies - odd offset behaviour

Résolue

I'm not sure where I pulled from the legacy URL (without paged/ at the end)

But thanks for helping me,
Have a great one.