I am using /crm/v3/objects/tickets/search to search tickets. The issue I am having is I am expecting more than 200 results, but there’s a limit of 200 with a search. I believe the “after” parameter is my solution to query additional pages of data but I can’t figure out what it is expecting there, or how it is used.
Hey, @DanaIrvine
I completely understand why this is confusing until you do it a few times.
I don’t have 200+ Tickets in my test portal, but I think I can still give an example that is enough to get you started.
In my test portal, I have 12 Tickets:
For our example purposes, we’ll make our request using a `Limit` of 5, and then use the `After` value to page through the others.
Request one (to get `after` value)
Request
POST https://api.hubapi.com/crm/v3/objects/tickets/search
Request body
{
"limit": 5
}
Response
{
"total": 12,
"results": [
{
"id": ...
}
],
"paging": {
"next": {
"after": "5"
}
}
}
For all the following requests, we will include the `after` value in our requests in the body
Request #2 (which will return the next five tickets)
Body
{
"limit": 5,
"after": "5"
}
Request #3 (which will return the last two tickets)
Body
{
"limit": 5,
"after": "10"
}
In your case, since you are not sending a `limit` value, I’d expect the `after` values to come in increments of 200 for each response — “after”: “200”, “after”: “400”, “after”: “600”, etc.
For me personally, when I’m testing, I find Postman to be the easiest way to gain an understanding of how the Search API wants to behave.
I hope this helps get you moving forward! — Jaycee
Thanks, now I get an error.
This works, returns 5 records:
{
“limit”: 5,
“after”: “0”,
“properties”: [
“id”
],
“filterGroups”:[{
“filters”:[
{
“propertyName”:“hs_lastmodifieddate”,
“operator”:“BETWEEN”,
“highValue”: 1730260800000,
“value”:1727755200000
},
{
“propertyName”:“hs_pipeline”,
“operator”:“EQ”,
“value”:63784995
}
]
}],
“sorts”: [{
“propertyName”: “id”,
“direction”: “ASCENDING”
}
]
}
This gives an error , returns the same 5 records: “Invalid input JSON on line 27, column 3: Could not resolve subtype of [simple type, class
| com.hubspot.conversations.publicapi.core.messages.PublicMessageEgg]: missing type id property \u0027type\u0027”
{
“limit”: 5,
“after”: “5”,
“properties”: [
“id”
],
“filterGroups”:[{
“filters”:[
{
“propertyName”:“hs_lastmodifieddate”,
“operator”:“BETWEEN”,
“highValue”: 1730260800000,
“value”:1727755200000
},
{
“propertyName”:“hs_pipeline”,
“operator”:“EQ”,
“value”:63784995
}
]
}],
“sorts”: [{
“propertyName”: “id”,
“direction”: “ASCENDING”
}
]
}
The only difference is after 0 vs after 5.
- as Jaycee mentions, you should check the value of the total and paging.next.after values returned from your first call.
{ "total": 12, "results": [ { "id": ... } ],
"paging": { "next": { "after": "5" } } }
If these do not indicate addition records available then there may be something else going wrong.
Good luck!
Steve
Nevermind, assigned a variable in the wrong spot in my loop.. duh!
Meet with Dana Irvine<>
[A close up of a logo Description automatically generated]
[facebook]<> [linkedin] <> [twitter] <>
Dana Irvine (they/them/theirs)
IT Manager
Tel: 866.444.4615 x1007
Direct: 609-879-0020
www.paragonpayroll.com<>
Please note that all times are EST unless otherwise specified.
________________________________
From: Dana Irvine
Sent: Tuesday, October 29, 2024 11:16 AM
To: hubspot.prod|52220eb7|6fe2fc0f-89cb-443a-a18d-e14f3c523b06@replybyemail.usw2.prod.hosted.lithcloud.com
Subject: Re: Question on the “after” parameter
I am running this in powershell, the same JSON works in postman. Makes no sense.
