I am having trouble adding a new deal on pipedrive. I get the error message “deal title must be given” but i am pretty sure I am giving the title.
Since I couldn’t find any topic on this error, I’m thinking it probably is a mistake I made but I can’t find where it is !
Here is the log i am getting :
The “input” I am sending :
{
contentType: {
Accept: ‘application/json’,
‘Content-Type’: ‘application/x-www-form-urlencoded’
},
body: { title: ‘hey’, person_id: 3045, stage_id: 71 }
}
The code line :
controller.addADeal(input, function(error, response, context) {
if (error) throw error;
});
and the answer :
{
errorMessage: ‘HTTP Response Not OK’,
errorCode: 400,
errorResponse: ‘{“success”:false,“error”:“Deal title must be given.”,“error_info”:“Visitez developers.pipedrive.com pour en savoir plus sur l\u2019API de Pipedrive.”,“data”:null,“additional_data”:null}’
}
I already tried to change the quotes and I originally used the Reference page to know which data to send. But I just found out that I didn’t know how to use it. I wrote all the “header” section in one parameter of the input, instead of creating a new proprety for each line of the header.
(what I did : input[“Header”] = { “Accept”: “application/json”,
“Content-Type”: “application/x-www-form-urlencoded” };
what I should have done :
input[“Accept”] = “application/json”;
input[“Content-Type”] = “application/x-www-form-urlencoded”;
So thank you and please forgive me for creating this topic for a begginer mistake.
It would be useful for users like me to have a quick guide on how to use the Reference Page, and how to implement the code… But anyway, My problem is solved.