APIs & Integrations

varadan
Member

Getting a “400 Bad Request” when trying to create a deal

SOLVE

Hi i am trying to create a deal in hubspot using deal api , i am getting the following error(The remote server returned an error: (400) Bad Request.)

string strJsonData = "{" +
" "associations": {" +
" "associatedCompanyIds": [" +
"2905584" +
" ]," +
""associatedVids": [" +
"25992901" +
" ]" +
" }," +
" "properties": [" +
" {" +
" "value": "varadantestdeal"," +
" "name": "dealname"" +
" }," +
" {" +
" "value": "Customer made an inquiry"," +
" "name": "dealstage"" +
" }" +
" {" +
" "value": "Sales Pipeline"," +
" "name": "pipeline"" +
" }" +
" ]" +
"}";

0 Upvotes
1 Accepted solution
varadan
Solution
Member

Getting a “400 Bad Request” when trying to create a deal

SOLVE

Hi Derek_Gervais,

              Thanks for your reply , I did not give the internal value of the properties instead of that i gave the name of the property in the json, So only i got the 400 Bad Request, now i can able to create deal.

View solution in original post

2 Replies 2
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Getting a “400 Bad Request” when trying to create a deal

SOLVE

Hi @varadan,

Are you including the Content-type header? It must be explicitly included and set to application/json.

0 Upvotes
varadan
Solution
Member

Getting a “400 Bad Request” when trying to create a deal

SOLVE

Hi Derek_Gervais,

              Thanks for your reply , I did not give the internal value of the properties instead of that i gave the name of the property in the json, So only i got the 400 Bad Request, now i can able to create deal.