Hi all, how do I retrieve all open tickets only for a specified contact? Right now I’m using the Associations (Ticket by Contact) endpoint to retrieve all tickets for the contact and looping through all returned tickets and calling the Tickets API for each to find open ones. Hoping there’s a better way!
Hey @SC2019,
By open tickets do you mean ticket that doesn’t have status == closed?
If so, you can use the crm v3 search endpoint: CRM API | Search
i.e.
POST crm/v3/objects/tickets/search
{
"filterGroups":[
{
"filters":[
{
"propertyName":"associations.contact",
"operator":"EQ",
"value":"{{contact id}}"
},
{
"propertyName":"hs_pipeline_stage",
"operator":"NEQ",
"value":"{{the pipeline stage id for closed. if you're using the default pipeline, this should be 4}}"
}
]
}
]
}
This will search for ticket that are associated to a particular contact ID and doesn’t have a ticket status == closed.
Thanks so much Wendy!