APIs & Integrations

AviA
Member

Create Ticket and associate with a company

SOLVE

Hi,

I'm trying to create a ticket with the api
https://api.hubapi.com/crm/v3/objects/tickets?hapikey=X
with a simple body request:

{
  "properties": {
    "hs_pipeline": some_id,
    "hs_pipeline_stage": some_id,
    "subject": "test"
  }
}

and I want to associate it with a company at the same time with the above POST request.

Can it be done without making another PUT request to associations endpoint ?

If so, what do I need to add to the POST body ?

0 Upvotes
1 Accepted solution
dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

Create Ticket and associate with a company

SOLVE

Hi @AviA 

Per the docs:

Associations between tickets and other objects

Tickets can be associated with contacts, companies, deals, or engagements. These associations are managed through the CRM associations endpoints.

 

But I could totally understand the value.  I suggest creating an idea for this and placing in the ideas board

View solution in original post

0 Upvotes
4 Replies 4
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Create Ticket and associate with a company

SOLVE

Hi @AviA ,


You can use this api for association : https://legacydocs.hubspot.com/docs/methods/crm-associations/associate-objects

Screen shot : https://prnt.sc/1vymo8z

Example PUT URL:
https://api.hubapi.com/crm-associations/v1/associations?hapikey=demo

Example PUT JSON:
{
"fromObjectId": <TICKET_ID>,
"toObjectId": <COMPANY_ID>,
"category": "HUBSPOT_DEFINED",
"definitionId": 26
}

OR

Example PUT JSON:
{
"fromObjectId": <COMPANY_ID>,
"toObjectId": <TICKET_ID>,
"category": "HUBSPOT_DEFINED",
"definitionId": 25
}

Documentation Link : https://legacydocs.hubspot.com/docs/methods/crm-associations/associate-objects

Table Defination Link : https://legacydocs.hubspot.com/docs/methods/crm-associations/crm-associations-overview

Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

0 Upvotes
AviA
Member

Create Ticket and associate with a company

SOLVE

Hi @webdew 

Thanks for the reply.
This is what we currently do, but I was looking for a way to do it in the same first POST request as it seems like a waste of calls to the API to do two things on the same object.
In addition, it does not break the REST rules as it is only a relationship to add to the request's body (it is used in a JSON API).

dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

Create Ticket and associate with a company

SOLVE

Hi @AviA 

Per the docs:

Associations between tickets and other objects

Tickets can be associated with contacts, companies, deals, or engagements. These associations are managed through the CRM associations endpoints.

 

But I could totally understand the value.  I suggest creating an idea for this and placing in the ideas board

0 Upvotes
AviA
Member

Create Ticket and associate with a company

SOLVE