Hi, someone knows if it possible to get the last 150 contacts to via API with condition field equal to certain value and to get only a few field data?
Hi @aviho
Your best bet if you’re only looking to get the most recent contacts; in this case the most recent 150 contacts, is to use the Get recently updated and created contacts endpoint.
This endpoint will allow you to fetch contacts going back 30 days but is limited to 100 per page. Therefore, we can use a count parameter to restrict the results to the recent 150 contacts.
We’d get a Request URL looking like this:
https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent?hapikey={{hapikey}}&count=100
With this request, we’d then get an offset value to work with which would give us the next page of results, but to make this easier, we can update the &count parameter to be equal to 50, this way 3 requests with 2 using offset parameters will return the 150 for you.
I hope this helps!
thanks for your reply
But I would like to make a request to get the last
150 but only if they have a field equal to a certain value
Hi @aviho
Have you tried using the new v3 Search, the documentation can be found here: Accounts Dashboard | HubSpot
With this, you can filter, sort and search CRM objects. If you’re looking to filter results when a property is equal to a specific value, you can use a filter such as the following:
{
"filterGroups":[
{
"filters":[
{
"propertyName": "firstname",
"operator": "EQ",
"value": "Alice"
}
]
}
]
}
This request is made to the following endpoint:
POST https://api.hubapi.com/crm/v3/objects/contacts/search?hapikey={{hapikey}}
I hope this helps!