APIs & Integrations

SC2019
Member

Get Open Tickets Only

SOLVE

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!

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Get Open Tickets Only

SOLVE

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.  

View solution in original post

0 Upvotes
2 Replies 2
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Get Open Tickets Only

SOLVE

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.  

0 Upvotes
SC2019
Member

Get Open Tickets Only

SOLVE

Thanks so much Wendy!

0 Upvotes