pagination issue

Hi,

we where using the hubspot API to fetch all the contact, we were using the pagination system who will add the after and link value,

but since this morning I can get the 2 first pages but next the pagination seems to be wrong the object return by the API is :

paging: { next: { after: '100' } }

instead of :

paging: { next: { after: 'MTY0MDQxOTEx', link: 

'https://api.hubapi.com/crm/v3/owners?after=MTY0MDQxOTEx' }

who break or loop .

we use this endpoint :

‘https://api.hubapi.com/crm/v3/objects/companies/search’

is this something expected or it’s a bug ?

Thanks,

@nturcksin

This is expected. I am confused by your code. Looks like you are referencing two different endpoints.

In your post body request for the search the crm API, you will include the after: 100 or whatever is returned to you to get the next set of results. An example would look like this:

{
 "filterGroups": [
 {
 "filters": [
 {
 "value": "larry",
 "propertyName": "firstname",
 "operator": "EQ"
 }
 ]
 }
 ],
 "limit": 1,
 "after": "1"
}

I did notice that the docs display it a different way in the example. I will see about getting that corrected!

I believe some of the confusion comes in the documentation located here:
CRM API | Companies (hubspot.com)

The example gives the “after” & “link”:

{
 "total": 0,
 "results": [
...
],
 "paging": {
 "next": {
 "after": "NTI1Cg%3D%3D",
 "link": "?after=NTI1Cg%3D%3D"
 }
 }
}

instead of the actual “after”: 10.
That can lead to some confusion if you don’t know to add “after” as a parameter in the body.