Get all companies - odd offset behaviour

SOLVE
Occasional Contributor

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?

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Community Manager

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

Reply
0 Upvotes
4 Replies 4
Community Manager

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.

Reply
0 Upvotes
Occasional Contributor

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

Reply
0 Upvotes
Highlighted
Community Manager

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

Reply
0 Upvotes
Occasional Contributor

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.