APIs & Integrations

pradheep
Member

Error while creating a Deal with API

I have created a Deal Property and then when i create a Deal with this property. it says that the property does not exist. Kindly help

0 Upvotes
8 Replies 8
pradheep
Member

Error while creating a Deal with API

{
    "validationResults": [
        {
            "isValid": false,
            "message": "Property \"hs_custom_crm_test\" does not exist",
            "error": "PROPERTY_DOESNT_EXIST",
            "name": "hs_custom_crm_test"
        }
    ],
0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Error while creating a Deal with API

Hi, @pradheep.

 

I do see a custom deal property with the internal name hs_custom_crm_test in your account ending in 1917.

 

Can you share an example request URL (please remove any hapikey values) and payload which is prompting the error for account 1917?

Isaac Takushi

Associate Certification Manager
0 Upvotes
pradheep
Member

Error while creating a Deal with API

any updates.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Error while creating a Deal with API

Hi, @pradheep.

 

Thanks for sharing that information.

 

A few things jump out at me:

  • You are passing the pipeline value Advisor Pipeline, but that is the label of your pipeline, not its pipelineId. Pass default instead. This internal value can be viewed in SettingsSalesDealsAdvisor Pipeline</> and with the CRM Pipelines API.
  • Similarly, you are passing the dealstage value New Enquiry, but that is also the label of the deal stage, not its stageId. Use appointmentscheduled instead. These internal values can be viewed in SettingsSalesDealsAdvisor PipelineNew Enquiry</> and with the CRM Pipelines API.

After making these two changes, I was able to successfully create this test deal in your account.

Isaac Takushi

Associate Certification Manager
0 Upvotes
pradheep
Member

Error while creating a Deal with API

Did you manage to create this deal with API ? , please share the details to me  if so.

 

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Error while creating a Deal with API

Hi, @pradheep.

 

Yes, I made a POST request with an internal REST client with the following body:

 

{
	"associations":{
		"associatedVids":[
			4951
		],
		"additionalProperties":{

		}
	},
	"properties":[
		{
			"name":"lp_coverage_duration",
			"value":"Till Age 65"
		},
		{
			"name":"lp_coverage_amount",
			"value":"400000.0"
		},
		{
			"name":"lp_premium_waiver",
			"value":"false"
		},
		{
			"name":"dealstage",
			"value":"appointmentscheduled"
		},
		{
			"name":"pipeline",
			"value":"default"
		},
		{
			"name":"plan_type",
			"value":"TM Term Assure II"
		},
		{
			"name":"dealname",
			"value":"HubSpot Support Test API Deal | Please Ignore"
		}
	]
}

As noted above, I only changed the values for pipeline and dealstage. I also changed the dealname value from your example.

Isaac Takushi

Associate Certification Manager
0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Error while creating a Deal with API

If you still receive 400 error messages after changing these values, your application must be placing HTTP requests incorrectly.

Isaac Takushi

Associate Certification Manager
0 Upvotes
pradheep
Member

Error while creating a Deal with API

INFO    2020-03-24 20:45:22,394 [SimpleAsyncTaskExecutor-2] com.bfa.serviceimpl.hubspot.HubSpotService  - Printing the hubspot base URL :https://api.hubapi.com/deals/v1/deal?hapikey=axy

INFO    2020-03-24 20:45:22,395 [SimpleAsyncTaskExecutor-2] com.bfa.serviceimpl.hubspot.HubSpotService  - Printing the request body :{"associations":{"associatedVids":[4951],"additionalProperties":{}},"properties":[{"name":"lp_coverage_duration","value":"Till Age 65"},{"name":"lp_coverage_amount","value":"400000.0"},{"name":"lp_premium_waiver","value":"false"},{"name":"dealstage","value":"New Enquiry"},{"name":"pipeline","value":"Advisor Pipeline"},{"name":"plan_type","value":"TM Term Assure II"},{"name":"dealname","value":"Coverage Duration:Till Age 65|Coverage Amount:400000.0|Premium Waiver:false"}]}

Making a POST request : https://api.hubapi.com/deals/v1/deal?hapikey=abc

Printing the hubspot deal response:<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 400 Bad Request</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /deals/v1/deal. Reason:
<pre>    Bad Request</pre></p>
</body>
</html>
0 Upvotes