APIs & Integrations

Not applicable

Create deal with company and contact associations (Create Deal API)

Hi,

I am trying to create deal with company and contact association and getting error :
Array
(
[status] => error
[message] => Invalid input JSON: Invalid JSON input: Unsupported java type [LONG] for field [associated_vids] for json type VALUE_STRING
[correlationId] => 191534ae-0d85-4f2e-8347-7e159ea6f93b
[requestId] => 6b90631d-79c7-40cd-9092-8668c5e516a1
)

My json array for creating deal is :

“associations”:{“associatedCompanyIds”:[“223609512”],“associatedVids”:[“1451”]},“properties”:[{“name”:“dealname”,“value”:“kaith Company New1 New Deal”},{“name”:“amount”,“value”:“245.82”},{“name”:“dealstage”,“value”:“appointmentscheduled”}]}

Is there any way to create deal with company / contact associations?

Thanks in advance for your help.

0 Upvotes
7 Replies 7
Not applicable

Create deal with company and contact associations (Create Deal API)

Hi,

I am facing error “one or more associations were invalid” in create deal API :

{“status”:“error”,“message”:“one or more associations were invalid”,“correlationId”:“be4c53b3-fc4d-48f3-b667-c11f5f658f72”,“requestId”:“06104b71-cd19-4988-a201-a6dd49323dca”}

My json is :

{“associations”:{“associatedVids”:[60675]},“properties”:[{“name”:“dealname”,“value”:“Jan 05 | Lunch 11:45 AM | SmartData Food Zone”},{“name”:“amount”,“value”:26.82},{“name”:“dealstage”,“value”:“2a5db756-e6a4-4505-b620-ad179304378d”},{“name”:“pipeline”,“value”:“default”},{“name”:“dealtype”,“value”:“newbusiness”},{“name”:“discount_off”,“value”:0},{“name”:“discount_percent_off”,“value”:""},{“name”:“gm_percent”,“value”:26.98},{“name”:“quote_url”,“value”:“http://alpha.foomanchew.com/admin/eplus/create_order/1165"},{“name”:“order_id”,“value”:1165},{“name”...”}]}

Thanks in advance for your help.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Create deal with company and contact associations (Create Deal API)

That usually means that the ID specified doesn’t belong to a valid record. If you’ve previously used that vid it’s possible that the record was deleted.

0 Upvotes
Not applicable

Create deal with company and contact associations (Create Deal API)

Thanks @dadams … Got your point and issue. Thanks for your help … !!!

0 Upvotes
Not applicable

Create deal with company and contact associations (Create Deal API)

Thanks for reply :slight_smile: it works !!!

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Create deal with company and contact associations (Create Deal API)

Hi @kaith

The associated IDs need to be passed as numbers, not strings, so all you should need to do is remove the quotes "" around the IDs.

"associations":{"associatedCompanyIds":[223609512],"associatedVids":[1451]},
0 Upvotes
Rafael_Fernande
Member

Create deal with company and contact associations (Create Deal API)

@dadams Hi. I am trying to mass import a list of deals and need to associate them to companies that I have created. I am new to the API world and don’t know where to paste the code you provided above. I have created a developer portal and created my first app … where do I go next? Thanks

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Create deal with company and contact associations (Create Deal API)

@Rafael_Fernandes the app in HubSpot is just a set of settings that would let you authenticate your system with a HubSpot account. Any actual code would need to be implemented outside of HubSpot.

The documentation for the endpoint mentioned in the post is here:

Create a Deal | Deals API

POST /deals/v1/deal/ - For a given portal, create a deal. This is particularly useful if you're integrating with a CRM or another application that has a similar notion of a deal. Note that you can create associations between Deals and Contacts and...

0 Upvotes