APIs & Integrations

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Hi All,

 

Trying to get Ticket details via a custom associate,

 

I have created the ticket and added the custom associate so that the same can be used to get the ticket info.

 

Here is the API URL for your reference:

https://api.hubapi.com/crm/v3/objects/tickets/search?hapikey=*API Keys*

Here are the JSON filter details:

 

{"after":0,"limit":1,"filters":[{"operator":"EQ","propertyName":"associations.{meta-type}-{object_type_id}","value":"<value>"}]}

 

Getting below Response:

{
    "status""error",
    "message""There was a problem with the request.",
    "correlationId""1a4d1e52-f50f-4d5c-895f-f123f5236c38"
}
Any assistance you can provide would be greatly appreciated.
 
1 Accepted solution
MichaelC
Solution
Guide | Partner
Guide | Partner

Trying to get Ticket details using Search API and custom associate

SOLVE

@aolvikash 

 

I would advice you to do one more call - using the search API.

https://developers.hubspot.com/docs/api/crm/search

Search for tickets where create date is less then - or greater then a specific date. You have to lookup the property names yourself but use search to get an array of ticket id while using search.

 

Then compare the array you got from associations with the ids that you got from the search. If the id is in both search as well as the association -- do a specific task -- if not - ignore. 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

View solution in original post

9 Replies 9
MichaelC
Solution
Guide | Partner
Guide | Partner

Trying to get Ticket details using Search API and custom associate

SOLVE

@aolvikash 

 

I would advice you to do one more call - using the search API.

https://developers.hubspot.com/docs/api/crm/search

Search for tickets where create date is less then - or greater then a specific date. You have to lookup the property names yourself but use search to get an array of ticket id while using search.

 

Then compare the array you got from associations with the ids that you got from the search. If the id is in both search as well as the association -- do a specific task -- if not - ignore. 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Thanks a lot, @MichaelC , Finally this works!!

MichaelC
Guide | Partner
Guide | Partner

Trying to get Ticket details using Search API and custom associate

SOLVE

@aolvikash 

 

propertyName needs to be an actual property name. 

Do you have access to the portal and can go to settings - properties - filter by ticket properties - find the custom made property - edit property - find the internal name using the "</>" sign.

MichaelC_0-1619539504372.png

 

Are you sure you are looking for a property in the first place and not an association to a ticket? (https://developers.hubspot.com/docs/api/crm/associations)



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Hi @MichaelC ,

 

Thanks for your time !!

 

Let me give you some background of this issue, we have a Ticket object as HubSpot defined object and I have one custom object call Assets, When I create the ticket I used to create the associates for a ticket to Asset as well.

 

Now the point is, I want to fetch the ticket details based on any Assets that's when I had used association.{meta-type}-{object_type_id} from Ticket search API. Here is the API query URL and json data:

 

https://api.hubapi.com/crm/v3/objects/tickets/search?hapikey=*API Keys*

Here are the JSON filter details:

 

{"after":0,"limit":1,"filters":[{"operator":"EQ","propertyName":"associations.{meta-type}-{object_type_id}","value":"<value>"}]}
 
Please let me know your advice on this!!
MichaelC
Guide | Partner
Guide | Partner

Trying to get Ticket details using Search API and custom associate

SOLVE

@aolvikash 

 

Great description, makes it a lot easier for me to understand.

 

I do think that you need to do this in several steps. 

 

1. Use the associations api to fetch the ID of the tickets that are associated between assets and tickets. 

https://developers.hubspot.com/docs/api/crm/associations 

Endpoint: read batch of associations

This will return a list of object ids - either all tickets or all assets associated to a ticker / asset. 

 

2. Use thoes ids you got in step one to do updates in properties through out the objects api. 

 

I think simply you are in the wrong place looking. When searching for associations you need to use the associations api (see point 1 above). 



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Sure @MichaelC , Let me try this option, I will keep you posted on the status!!

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Hi @MichaelC ,

 

Yes, I can able to fetch the ticket id's via above point 1 [https://developers.hubspot.com/docs/api/crm/associations ].

 

Using the above association I have got the list of Tickets id's for that asset, this may be more than 100 IDs [tickets]. 

 

Now I want to fetch the Ticket id which is created in the last couple of hours and with a specific subject.  I have used API - <https://api.hubapi.com/crm-objects/v1/objects/tickets/batch-read> and passed the list of Ticket IDs [important] but not sure how to add another filter such as ticket subject and created date and get the ticket id.

 

Could you please let me know if any other way to get this info or in this process how to add the filters?

dennisedson
HubSpot Product Team
HubSpot Product Team

Trying to get Ticket details using Search API and custom associate

SOLVE

@aolvikash 

This is probably the issue : associations.{meta-type}-{object_type_id}"

Can you replace that with the actual association name to see if it works?

@RMones@dannio  do you all have suggestions?

aolvikash
Participant

Trying to get Ticket details using Search API and custom associate

SOLVE

Hi @dennisedson ,

 

Thanks for your response!

 

I have tried all 3 ways what I know but getting same response as follows:

 

associations.{meta-type}-{object_type_id}

associations.p{portal_id}_{object_name}

associations.<actual_associate_name>

 

Please see if anyone can assist here !!