Create Note

I’m trying to create a Note against a Sales Account in the Freshsales CRM. I have tried via cURL & Postman and get a 404 error on both - but I can’t see anything wrong with below? (I know the token is correct). For the purpose of this post, I have removed the token and modified the URL.

Any help would be appreciated!


$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://domainNameHere.myfreshworks.com/crm/sales/api/notes",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => "{\"note\":{
    \"targetable_type\":\"SalesAccount\",
    \"targetable_id\":\"31001399896\", 
    \"description\":\"Completed the onboarding process.\"}}",

    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "content-type: application/json",
        "Authorization: Token token=tokenHere"
    ),
));

$response = curl_exec($curl);

$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

echo $httpcode;

if (curl_errno($curl)) {
    $error_msg = curl_error($curl);
}
curl_close($curl);

if (isset($error_msg)) {
    // TODO - Handle cURL error accordingly
    echo $error_msg;
}```

@Graeme_Law - Could you share a screenshot of the error response? Maybe Postman or Curl?

Hi @Graeme_Law

From the error response, it seems like the given sales account id is not found. Can you please try the request with targetable_id as a number value instead of a string?