Confusing error message when trying to create note from Postman

Hi there,

I’m trying to create a note on the organization level via API.
Doing that in a standalone request in Postman works just fine, but doing it in the Test script (see below) gives me a strange error I’m unable to fix.
I’m doing the same thing, passing on a JSON body to the API endpoint with the “content” and “org_id”, so the error message doesn’t make sense.

pm.sendRequest({

url: "https://api.pipedrive.com/v1/notes?api_token=XXXXXXXX",

method: "POST",

header: {

"Content-Type": "application/json"

},

body: {

"content": "test note",

"org_id": 446

}

}, (error, response) => {

if (error) {

console.error(error);

} else {

console.log(response.json());

}

});

error message:

{

success: false,

error: 'Note needs to have a content.',

  error_info: 'Please check developers.pipedrive.com for more information about Pipedrive API.',

data: null,

additional_data: null

}

Hello, @florian and welcome to the community! :wave:

It seems you need to specify a few extra fields inside the body. Check out the solution in this StackOverflow thread.

Sincerely,
Helena

You are my hero, thank you so much!!!

For everybody else who’s reading this, I changed my code to:

pm.sendRequest({

url: "https://api.pipedrive.com/v1/notes?api_token=XXXXXXXX",

method: "POST",

header: {

"Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json"
    },
    body: {
    mode: 'urlencoded',
    urlencoded : [
      { key: 'content', value: 'test note'},
      { key: 'org_id', value: '446'},
    ]
    }
}, (error, response) => {
    if (error) {
        console.error(error);
    } else {
        console.log(response.json());
    }
});
1 Like