APIs & Integrations

ssaleem2
Member

Deals API Search filter with limit and After not working.

Hi foks. 
I'm trying to filter "Confirmed" deals greater than specific "createdate", with POST method.

But after=10 and limit is not working with my filters. I shared endpoint with body parameters. 

Endpoint

https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=API_KEY_HERE.

 

Body:

{
"filterGroups":[
{
"filters":[
{
"propertyName""createdate",
"operator""GTE",
"value""1642618800000"
},
{
"propertyName""dealstage",
"operator""EQ",
"value""2218486"
}
],
"limit"100,
"after":0
}
]
}

I tried all possible ways. Is there any solution for this. 
Thanks
0 Upvotes
4 Replies 4
SCummins4
Member

Deals API Search filter with limit and After not working.

It is because you have put the limit and after properties inside the filterGroups object.

 

See example JSON below:

 

{
"filterGroups": [
{
"filters": [
{
"value": "from_date",
"propertyName": "hs_lastmodifieddate",
"operator": "GTE"
},
{
"value": "to_date",
"propertyName": "hs_lastmodifieddate",
"operator": "LTE"
},
{
"values": "pipeline",
"propertyName": "pipeline",
"operator": "IN"
}
]
}
],
"sorts": [
"Id"
],
"properties": [
"pipeline",
"hs_stage"
],
"limit": 100,
"after": "after"
}

 

This example also incudes the sort and properties objects and these also sit outside the filterGroups object. You can simply remove these if you don't need them. Also some of the property values referenced runtime variables so I have just encapsulated them in quotes so the JSON parses but you should get the gist.

Jaycee_Lewis
Community Manager
Community Manager

Deals API Search filter with limit and After not working.

Thanks for sharing, @SCummins4 🙌

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Deals API Search filter with limit and After not working.

Hi  @ssaleem2 ,

if you set your limit 100 then after also should be 100 as you mentioned 0 so just set limit 100 and after also 100 : please follow this : https://prnt.sc/26kmm7c , https://developers.hubspot.com/docs/api/crm/search

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards. 

0 Upvotes
ssaleem2
Member

Deals API Search filter with limit and After not working.

Hi @webdew 
Thanks for replying. But problem is following limit and after parameters is not working in any case.
Please have a look following parameters. API retured 63 Total records, It should be show 20 per page and after 20 as per mentioned in parameters. But It's returing first 10 records only every time either I user after or not, result is same. 
Need your help how limit and after parameter will work. 
Thanks

{
"filterGroups":[
{
"filters":[
{
"propertyName""createdate",
"operator""GTE",
"value""1642618800000"
},
{
"propertyName""dealstage",
"operator""EQ",
"value""2218486"
}
],
"limit"20,
"after":20
}
]
}