APIs & Integrations

Tharun
Member

Associate Deal/Contact with a Ticket using api

Hi,

    Can someone help me by showing sample request/response or real-world postman requests on how to associate a deal or contact a ticket using association API? I went through the official API documentation, but it is lacking information and also there are no examples with real-world properties

0 Upvotes
2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

Associate Deal/Contact with a Ticket using api

Hey, @Tharun 👋 In my experience, the Community will need additional information to help you out in the manner you are requesting. This includes:

  • the specific documentation you've referenced
  • the endpoint you're using
  • an example of the JSON request and error returned (if any)

One question — are you using the v1 or v4 version of the Associations API? If it is the v4, here is an example of a successful test associating a Contact to a Ticket.

 

Endpoint used: 

PUT/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}

Request:

curl --request PUT \
  --url 'https://api.hubapi.com/crm/v4/objects/0-1/25251/associations/0-5/382260908?hapikey=MYHAPIKEY' \
  --header 'content-type: application/json' \
  --data '[
  {
    "associationCategory": "HUBSPOT_DEFINED",
    "associationTypeId": 15
  }
]'

Response:

HTTP 201
{
  "fromObjectTypeId": "0-1",
  "fromObjectId": 25251,
  "toObjectTypeId": "0-5",
  "toObjectId": 382260908,
  "labels": []
}

Documentation:

In my test, I used the v4 Associations endpoint. If you have additional specific questions, please add them here, and we'll see if the community has insight or feedback for you.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

APastran
Participant

Associate Deal/Contact with a Ticket using api

Hi Jaycee!!

I searched for this a lot, thank you. Nevertheless, I still need a little bit more to achieve the goal.
- When I associate the contact to the ticket, I also want to transfer or define the association label. Could you please give me an example doing this? 
Thank you!
Have a good one!

0 Upvotes