Update Notes
Purpose
To update an existing note.
Request Details
Request URL
{api-domain}/crm/{version}/Notes
To update a specific note:
{api-domain}/crm/{version}/Notes/{note_id}
To update notes of a specific record:
{api-domain}/crm/{version}/{module_api_name}/{record_id}/Notes
Supported modules
Leads, Accounts, Contacts, Deals, Campaigns, Tasks, Cases, Events, Calls, Solutions, Products, Vendors, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, and Custom
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
(and)
scope=ZohoCRM.modules.notes.{operation_type}
Possible module names
leads, accounts, contacts, deals, campaigns, tasks, events, calls, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, and custom
Possible operation types
ALL - Full access to notes
WRITE - Edit note data
UPDATE - Update note data
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v2.1/Notes/4150868000002975099"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@updatenote.json"
-X PUT
Copied//Get instance of NotesOperations Class
NotesOperations notesOperations = new NotesOperations();
//Get instance of BodyWrapper Class that will contain the request body
BodyWrapper bodyWrapper = new BodyWrapper();
//List of Note instances
List < com.zoho.crm.api.notes.Note > notes = new ArrayList < com.zoho.crm.api.notes.Note > ();
//Get instance of Note Class
com.zoho.crm.api.notes.Note note = new com.zoho.crm.api.notes.Note();
note.setId(3477061000006154001 L);
//Set Note_Title of the Note
note.setNoteTitle("Contacted12");
//Set NoteContent of the Note
note.setNoteContent("Need to do further tracking12");
//Add Note instance to the list
notes.add(note);
note = new com.zoho.crm.api.notes.Note();
note.setId(3477061000006154002 L);
//Set Note_Title of the Note
note.setNoteTitle("Contacted13");
//Set NoteContent of the Note
note.setNoteContent("Need to do further tracking13");
//Add Note instance to the list
notes.add(note);
//Set the list to notes in BodyWrapper instance
bodyWrapper.setData(notes);
//Call updateNotes method that takes BodyWrapper instance as parameter
APIResponse < ActionHandler > response = notesOperations.updateNotes(bodyWrapper);
Copiedpackage com.zoho.crm.api.sample.restapi.notes;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONObject;
public class UpdateNotes
{
@SuppressWarnings("deprecation")
private static void updateNotes()
{
try
{
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
SSLContext sslContext = SSLContext.getDefault();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
URIBuilder uriBuilder = new URIBuilder("https://www.zohoapis.com/crm/v2.1/Notes");
HttpUriRequest requestObj = new HttpPut(uriBuilder.build());
HttpEntityEnclosingRequestBase requestBase = (HttpEntityEnclosingRequestBase) requestObj;
JSONObject requestBody = new JSONObject();
JSONArray recordArray = new JSONArray();
JSONObject recordObject = new JSONObject();
recordObject.put("id", "34770617772009");
recordObject.put("Note_Title", "Contacted11");
recordObject.put("Note_Content", "Tracking done. Happy with the customer");
recordArray.put(recordObject);
recordObject = new JSONObject();
recordObject.put("id", "34770617772010");
recordObject.put("Note_Title", "Contacted12");
recordObject.put("Note_Content", "Tracking done. Happy with the customer");
recordArray.put(recordObject);
requestBody.put("data", recordArray);
requestBase.setEntity(new StringEntity(requestBody.toString(), HTTP.UTF_8));
requestObj.addHeader("Authorization", "Zoho-oauthtoken 1000.xxxxxxx.xxxxxxx");
HttpResponse response = httpclient.execute(requestObj);
HttpEntity responseEntity = response.getEntity();
System.out.println("HTTP Status Code : " + response.getStatusLine().getStatusCode());
if(responseEntity != null)
{
Object responseObject = EntityUtils.toString(responseEntity);
String responseString = responseObject.toString();
System.out.println(responseString);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
@SuppressWarnings("deprecation")
private static void updateNote()
{
try
{
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
SSLContext sslContext = SSLContext.getDefault();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
URIBuilder uriBuilder = new URIBuilder("https://www.zohoapis.com/crm/v2.1/Notes/34770617772009");
HttpUriRequest requestObj = new HttpPut(uriBuilder.build());
HttpEntityEnclosingRequestBase requestBase = (HttpEntityEnclosingRequestBase) requestObj;
JSONObject requestBody = new JSONObject();
JSONArray recordArray = new JSONArray();
JSONObject recordObject = new JSONObject();
recordObject.put("Note_Title", "Contacted11");
recordObject.put("Note_Content", "Tracking done. Happy with the customer");
recordArray.put(recordObject);
requestBody.put("data", recordArray);
requestBase.setEntity(new StringEntity(requestBody.toString(), HTTP.UTF_8));
requestObj.addHeader("Authorization", "Zoho-oauthtoken 1000.xxxxxxx.xxxxxxx");
HttpResponse response = httpclient.execute(requestObj);
HttpEntity responseEntity = response.getEntity();
System.out.println("HTTP Status Code : " + response.getStatusLine().getStatusCode());
if(responseEntity != null)
{
Object responseObject = EntityUtils.toString(responseEntity);
String responseString = responseObject.toString();
System.out.println(responseString);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
@SuppressWarnings("deprecation")
private static void updateNotesofASpecificRecord()
{
try
{
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
SSLContext sslContext = SSLContext.getDefault();
SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
URIBuilder uriBuilder = new URIBuilder("https://www.zohoapis.com/crm/v2.1/Leads/34770617736020/Notes");
HttpUriRequest requestObj = new HttpPut(uriBuilder.build());
HttpEntityEnclosingRequestBase requestBase = (HttpEntityEnclosingRequestBase) requestObj;
JSONObject requestBody = new JSONObject();
JSONArray recordArray = new JSONArray();
JSONObject recordObject = new JSONObject();
recordObject.put("id", "34770617772009");
recordObject.put("Note_Title", "Contacted11");
recordObject.put("Note_Content", "Tracking done. Happy with the customer");
recordArray.put(recordObject);
recordObject = new JSONObject();
recordObject.put("id", "34770617772010");
recordObject.put("Note_Title", "Contacted12");
recordObject.put("Note_Content", "Tracking done. Happy with the customer");
recordArray.put(recordObject);
requestBody.put("data", recordArray);
requestBase.setEntity(new StringEntity(requestBody.toString(), HTTP.UTF_8));
requestObj.addHeader("Authorization", "Zoho-oauthtoken 1000.xxxxxxx.xxxxxxx");
HttpResponse response = httpclient.execute(requestObj);
HttpEntity responseEntity = response.getEntity();
System.out.println("HTTP Status Code : " + response.getStatusLine().getStatusCode());
if(responseEntity != null)
{
Object responseObject = EntityUtils.toString(responseEntity);
String responseString = responseObject.toString();
System.out.println(responseString);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public static void main(String[] args)
{
updateNotes();
updateNote();
updateNotesofASpecificRecord();
}
}
Copied//Get instance of NotesOperations Class
$notesOperations = new NotesOperations();
//Get instance of BodyWrapper Class that will contain the request body
$bodyWrapper = new BodyWrapper();
//List of Note instances
$notes = array();
$noteClass = 'com\zoho\crm\api\notes\Note';
//Get instance of Note Class
$note = new $noteClass();
$note->setId("34770616154001");
//Set Note_Title of the Note
$note->setNoteTitle("Contacted12");
//Set NoteContent of the Note
$note->setNoteContent("Need to do further tracking12");
//Add Note instance to the list
array_push($notes, $note);
$note = new $noteClass();
$note->setId("34770616153004");
//Set Note_Title of the Note
$note->setNoteTitle("Contacted13");
//Set NoteContent of the Note
$note->setNoteContent("Need to do further tracking13");
//Add Note instance to the list
array_push($notes, $note);
//Set the list to notes in BodyWrapper instance
$bodyWrapper->setData($notes);
//Call updateNotes method that takes BodyWrapper instance as parameter
$response = $notesOperations->updateNotes($bodyWrapper);
//Get instance of NotesOperations Class
$notesOperations = new NotesOperations();
//Get instance of BodyWrapper Class that will contain the request body
$bodyWrapper = new BodyWrapper();
//List of Note instances
$notes = array();
$nodeClass = 'com\zoho\crm\api\notes\Note';
$note = new $nodeClass();
//Set Note_Title of the Note
$note->setNoteTitle("Contacted12");
//Set NoteContent of the Note
$note->setNoteContent("Need to do further tracking12");
//Add Note instance to the list
array_push($notes, $note);
//Set the list to notes in BodyWrapper instance
$bodyWrapper->setData($notes);
//Call updateNote method that takes BodyWrapper instance and noteId as parameter
$response = $notesOperations->updateNote($noteId,$bodyWrapper);
Copied<?php
class UpdateNotes
{
public function execute(){
$curl_pointer = curl_init();
$curl_options = array();
$url = "https://www.zohoapis.com/crm/v2.1/Notes";
$curl_options[CURLOPT_URL] =$url;
$curl_options[CURLOPT_RETURNTRANSFER] = true;
$curl_options[CURLOPT_HEADER] = 1;
$curl_options[CURLOPT_CUSTOMREQUEST] = "PUT";
$requestBody = array();
$recordArray = array();
$recordObject = array();
$recordObject["Note_Title"]="Contacted";
$recordObject["Note_Content"]="Need to do further tracking";
// $recordObject["Parent_Id"]="3524033000005811001";
// $recordObject["se_module"]="Leads";
$recordObject["id"]="3524033000006014002";
$recordArray[] = $recordObject;
$requestBody["data"] =$recordArray;
$curl_options[CURLOPT_POSTFIELDS]= json_encode($requestBody);
$headersArray = array();
$headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " ."1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
$curl_options[CURLOPT_HTTPHEADER]=$headersArray;
curl_setopt_array($curl_pointer, $curl_options);
$result = curl_exec($curl_pointer);
$responseInfo = curl_getinfo($curl_pointer);
curl_close($curl_pointer);
list ($headers, $content) = explode("\r\n\r\n", $result, 2);
if(strpos($headers," 100 Continue")!==false){
list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
}
$headerArray = (explode("\r\n", $headers, 50));
$headerMap = array();
foreach ($headerArray as $key) {
if (strpos($key, ":") != false) {
$firstHalf = substr($key, 0, strpos($key, ":"));
$secondHalf = substr($key, strpos($key, ":") + 1);
$headerMap[$firstHalf] = trim($secondHalf);
}
}
$jsonResponse = json_decode($content, true);
if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
list ($headers, $content) = explode("\r\n\r\n", $content, 2);
$jsonResponse = json_decode($content, true);
}
var_dump($headerMap);
var_dump($jsonResponse);
var_dump($responseInfo['http_code']);
}
}
(new UpdateNotes())->execute();
Copied//Get instance of NotesOperations Class
NotesOperations notesOperations = new NotesOperations();
//Get instance of BodyWrapper Class that will contain the request body
BodyWrapper bodyWrapper = new BodyWrapper();
//List of Note instances
List<Com.Zoho.Crm.API.Notes.Note> notes = new List<Com.Zoho.Crm.API.Notes.Note>();
//Get instance of Note Class
Com.Zoho.Crm.API.Notes.Note note = new Com.Zoho.Crm.API.Notes.Note();
note.Id = 3477061000007376024;
//Set Note_Title of the Note
note.NoteTitle = "Contacted12";
//Set NoteContent of the Note
note.NoteContent = "Need to do further tracking12";
//Add Note instance to the list
notes.Add(note);
note = new Com.Zoho.Crm.API.Notes.Note();
note.Id = 3477061000007376023;
//Set Note_Title of the Note
note.NoteTitle = "Contacted13";
//Set NoteContent of the Note
note.NoteContent = "Need to do further tracking13";
//Add Note instance to the list
notes.Add(note);
//Set the list to notes in BodyWrapper instance
bodyWrapper.Data = notes;
//Call UpdateNotes method that takes BodyWrapper instance as parameter
APIResponse<ActionHandler> response = notesOperations.UpdateNotes(bodyWrapper);
Copiedusing System;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Com.Zoho.Crm.API.Sample.RestAPI.Notes
{
public class UpdateNotes
{
public static void UpdateListNote()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.zohoapis.com/crm/v2.1/Notes");
request.Method = "PUT";
request.Headers["Authorization"] = "Zoho-oauthtoken 1000.abfeXXXXXXXXXXX2asw.XXXXXXXXXXXXXXXXXXsdc2";
JObject requestBody = new JObject();
JArray recordArray = new JArray();
JObject recordObject = new JObject();
recordObject.Add("id", "3477067008004");
recordObject.Add("Note_Title", "Contacted11");
recordObject.Add("Note_Content", "Tracking done. Happy with the customer");
recordArray.Add(recordObject);
recordObject = new JObject();
recordObject.Add("id", "347706107008005");
recordObject.Add("Note_Title", "Contacted12");
recordObject.Add("Note_Content", "Tracking done. Happy with the customer");
recordArray.Add(recordObject);
requestBody.Add("data", recordArray);
string dataString = requestBody.ToString();
var data = Encoding.UTF8.GetBytes(dataString);
int dataLength = data.Length;
request.ContentLength = dataLength;
using (var writer = request.GetRequestStream())
{
writer.Write(data, 0, dataLength);
}
request.KeepAlive = true;
HttpWebResponse response;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException e)
{
if (e.Response == null) { throw; }
response = (HttpWebResponse)e.Response;
}
HttpWebResponse responseEntity = response;
Console.WriteLine("HTTP Status Code : " + (int)response.StatusCode);
string responsestring = new StreamReader(responseEntity.GetResponseStream()).ReadToEnd();
responseEntity.Close();
Console.WriteLine(responsestring);
}
public static void UpdateNote()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.zohoapis.com/crm/v2.1/Notes/3477061000007008005");
request.Method = "PUT";
request.Headers["Authorization"] = "Zoho-oauthtoken 1000.abfeXXXXXXXXXXX2asw.XXXXXXXXXXXXXXXXXXsdc2";
JObject requestBody = new JObject();
JArray recordArray = new JArray();
JObject recordObject = new JObject();
recordObject.Add("Note_Title", "Contacted11");
recordObject.Add("Note_Content", "Tracking done. Happy with the customer");
recordArray.Add(recordObject);
requestBody.Add("data", recordArray);
string dataString = requestBody.ToString();
var data = Encoding.UTF8.GetBytes(dataString);
int dataLength = data.Length;
request.ContentLength = dataLength;
using (var writer = request.GetRequestStream())
{
writer.Write(data, 0, dataLength);
}
request.KeepAlive = true;
HttpWebResponse response;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException e)
{
if (e.Response == null) { throw; }
response = (HttpWebResponse)e.Response;
}
HttpWebResponse responseEntity = response;
Console.WriteLine("HTTP Status Code : " + (int)response.StatusCode);
string responsestring = new StreamReader(responseEntity.GetResponseStream()).ReadToEnd();
responseEntity.Close();
Console.WriteLine(responsestring);
}
public static void UpdateNotesofASpecificRecord()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.zohoapis.com/crm/v2.1/Leads/3477061000007736020/Notes");
request.Method = "PUT";
request.Headers["Authorization"] = "Zoho-oauthtoken 1000.abfeXXXXXXXXXXX2asw.XXXXXXXXXXXXXXXXXXsdc2";
JObject requestBody = new JObject();
JArray recordArray = new JArray();
JObject recordObject = new JObject();
recordObject.Add("id", "3477061000007772009");
recordObject.Add("Note_Title", "Contacted11");
recordObject.Add("Note_Content", "Tracking done. Happy with the customer");
recordArray.Add(recordObject);
recordObject = new JObject();
recordObject.Add("id", "3477061000007772010");
recordObject.Add("Note_Title", "Contacted12");
recordObject.Add("Note_Content", "Tracking done. Happy with the customer");
recordArray.Add(recordObject);
requestBody.Add("data", recordArray);
string dataString = requestBody.ToString();
var data = Encoding.UTF8.GetBytes(dataString);
int dataLength = data.Length;
request.ContentLength = dataLength;
using (var writer = request.GetRequestStream())
{
writer.Write(data, 0, dataLength);
}
request.KeepAlive = true;
HttpWebResponse response;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException e)
{
if (e.Response == null) { throw; }
response = (HttpWebResponse)e.Response;
}
HttpWebResponse responseEntity = response;
Console.WriteLine("HTTP Status Code : " + (int)response.StatusCode);
string responsestring = new StreamReader(responseEntity.GetResponseStream()).ReadToEnd();
responseEntity.Close();
Console.WriteLine(responsestring);
}
}
}
Copied# Get instance of NotesOperations Class
notes_operations = NotesOperations()
# Get instance of BodyWrapper Class that will contain the request body
request = BodyWrapper()
# List to hold Note instances
notes_list = []
# Get instance of Note Class
note_1 = ZCRMNote()
# Set Note Content of the Note
note_1.set_note_content("Need to do further tracking 12")
# Set Note Title of the Note
note_1.set_note_title('Contacted 12')
# Set ID to Note
note_1.set_id(3409643000002193004)
# Add Note instance to the list
notes_list.append(note_1)
# Get instance of Note Class
note_2 = ZCRMNote()
# Set Note Content of the Note
note_2.set_note_content("Need to do further tracking 13")
# Set Note Title of the Note
note_2.set_note_title('Contacted 13')
# Set ID to Note
note_2.set_id(3409643000001930001)
# Add Note instance to the list
notes_list.append(note_2)
# Set the list to notes in BodyWrapper instance
request.set_data(notes_list)
# Call update_notes method that takes BodyWrapper instance as parameter
response = notes_operations.update_notes(request)
# Get instance of NotesOperations Class
notes_operations = NotesOperations()
# Get instance of BodyWrapper Class that will contain the request body
request = BodyWrapper()
# List to hold Note instances
notes_list = []
# Get instance of Note Class
note_1 = ZCRMNote()
# Set Note Content of the Note
note_1.set_note_content("Need to do further tracking 12")
# Set Note Title of the Note
note_1.set_note_title('Contacted 12')
# Add Note instance to the list
notes_list.append(note_1)
# Set the list to notes in BodyWrapper instance
request.set_data(notes_list)
# Call update_notes method that takes BodyWrapper instance as parameter
response = notes_operations.update_note(note_id, request)
Copieddef update_notes():
import requests
import json
url = 'https://www.zohoapis.com/crm/v2.1/Notes'
headers = {
'Authorization': 'Zoho-oauthtoken 1000.04be928e4a96XXXXXXXXXXXXX68.0b9eXXXXXXXXXXXX60396e268'
}
request_body = dict()
record_list = list()
record_object_1 = {
'id': '3409643000003049003',
'Note_Content': 'Tracking done. Happy with the customer',
}
record_object_2 = {
'id': '3409643000003049030',
'Note_Title': 'Follow Up - Update',
'Note_Content': 'Done',
}
record_list.append(record_object_1)
record_list.append(record_object_2)
request_body['data'] = record_list
response = requests.put(url=url, headers=headers, data=json.dumps(request_body).encode('utf-8'))
if response is not None:
print("HTTP Status Code : " + str(response.status_code))
print(response.json())
update_notes()
def update_note():
import requests
import json
url = 'https://www.zohoapis.com/crm/v2.1/Notes/3409643000003049003'
headers = {
'Authorization': 'Zoho-oauthtoken 1000.04be928e4a96XXXXXXXXXXXXX68.0b9eXXXXXXXXXXXX60396e268'
}
request_body = dict()
record_list = list()
record_object = {
'Note_Title': 'Contacted',
'Note_Content': 'Tracking done. Happy with the customer',
}
record_list.append(record_object)
request_body['data'] = record_list
response = requests.put(url=url, headers=headers, data=json.dumps(request_body).encode('utf-8'))
if response is not None:
print("HTTP Status Code : " + str(response.status_code))
print(response.json())
update_note()
Copied//Get instance of NotesOperations Class
let notesOperations = new NotesOperations();
//Get instance of BodyWrapper Class that will contain the request body
let request = new BodyWrapper();
//Array to hold Note instances
let notesArray = [];
//Get instance of Note Class
let note = new Note();
//Set ID to Note
note.setId(3409643000002193004n);
//Set Note_Title of the Note
note.setNoteTitle("Contacted12");
//Set NoteContent of the Note
note.setNoteContent("Need to do further tracking12");
//Add Note instance to the array
notesArray.push(note);
//Get instance of Note Class
note = new Note();
//Set ID to Note
note.setId(3409643000001930001n);
//Set Note_Title of the Note
note.setNoteTitle("Contacted13");
//Set NoteContent of the Note
note.setNoteContent("Need to do further tracking13");
//Add Note instance to the array
notesArray.push(note);
//Set the array to data in BodyWrapper instance
request.setData(notesArray);
//Call updateNotes method that takes BodyWrapper instance as parameter
let response = await notesOperations.updateNotes(request);
Copiedasync function updateNotes() {
const got = require("got");
let url = 'https://www.zohoapis.com/crm/v2.1/Notes'
let headers = {
Authorization : "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
let requestBody = {}
let recordArray = []
let recordObject1 = {
id : '3409643000003049003',
Note_Content :'Tracking done. Happy with the customer',
}
let recordObject2 = {
'id': '3409643000003049030',
'Note_Title': 'Follow Up - Update',
'Note_Content': 'Done',
}
recordArray.push(recordObject1)
recordArray.push(recordObject2)
requestBody['data'] = recordArray
let requestDetails = {
method : "PUT",
headers : headers,
body : JSON.stringify(requestBody),
encoding: "utf8",
throwHttpErrors : false
};
let response = await got(url, requestDetails)
if(response != null) {
console.log(response.statusCode);
console.log(response.body);
}
}
updateNotes()
async function updateNote() {
const got = require("got");
let url = 'https://www.zohoapis.com/crm/v2.1/Notes/3409643000003049003'
let headers = {
Authorization : "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
let requestBody = {}
let recordArray = []
let recordObject = {
Note_Title : 'Contacted',
Note_Content :'Tracking done. Happy with the customer',
}
recordArray.push(recordObject)
requestBody['data'] = recordArray
let requestDetails = {
method : "PUT",
headers : headers,
body : JSON.stringify(requestBody),
encoding: "utf8",
throwHttpErrors : false
};
let response = await got(url, requestDetails)
if(response != null) {
console.log(response.statusCode);
console.log(response.body);
}
}
updateNote()
async function updateNotesOfaSpecificRecord() {
const got = require("got");
let url = 'https://www.zohoapis.com/crm/v2.1/Contacts/3409643000002955026/Notes'
let headers = {
Authorization : "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
let requestBody = {}
let recordArray = []
let recordObject1 = {
id : '3409643000003049003',
Note_Content :'Tracking done. Happy with the customer',
}
let recordObject2 = {
'id': '3409643000003049030',
'Note_Title': 'Contacted',
'Note_Content': 'Tracking done. Happy with the customer',
}
recordArray.push(recordObject1)
recordArray.push(recordObject2)
requestBody['data'] = recordArray
let requestDetails = {
method : "PUT",
headers : headers,
body : JSON.stringify(requestBody),
encoding: "utf8",
throwHttpErrors : false
};
let response = await got(url, requestDetails)
if(response != null) {
console.log(response.statusCode);
console.log(response.body);
}
}
updateNotesOfaSpecificRecord()
Copied# Get instance of NotesOperations Class
notes_id = [3_524_033_000_005_936_004, 3_524_033_000_005_539_004]
no = Notes::NotesOperations.new
# List to hold Note instances
notes = []
(0..1).each do |i|
# Get instance of Note Class
note = Notes::Note.new
# Set Note Title of the Note
note.note_title = 'Contacted'
# Set Note ID of the Note
note.id = notes_id[i]
# Set Note Content of the Note
note.note_content = 'Need to do further tracking'
# Get instance of Record Class
parent_record = Record::Record.new
# Set ID of the Record
parent_record.id = 3_524_033_000_005_495_066
# Set ParentId of the Note
note.parent_id = parent_record
# Set SeModule of the Record
note.se_module = 'Leads'
notes.push(note)
end
# Get instance of BodyWrapper Class that will contain the request body
body_wrapper = Notes::BodyWrapper.new
# Set the list to notes in BodyWrapper instance
body_wrapper.data = notes
# Call update_notes method that takes BodyWrapper instance as parameter
response = no.update_notes(body_wrapper)
# Get instance of NotesOperations Class
no = Notes::NotesOperations.new
# Get instance of Note Class
note = Notes::Note.new
# Set Note Title of the Note
note.note_title = 'Contacted'
# Set Note Content of the Note
# note.note_content = 'Need to do further tracking'
# Get instance of Record Class
parent_record = Record::Record.new
# Set ID of the Record
parent_record.id = 3_524_033_000_005_495_066
# Set ParentId of the Note
note.parent_id = parent_record
# Set SeModule of the Record
note.se_module = 'Leads'
notes = [note]
# Get instance of BodyWrapper Class that will contain the request body
body_wrapper = Notes::BodyWrapper.new
# Set the list to notes in BodyWrapper instance
body_wrapper.data = notes
# Call update_notes method that takes BodyWrapper instance as parameter
response = no.update_note(note_id,body_wrapper)
Copiedrequire 'net/http'
require 'json'
class UpdateNotes
def execute
url ="https://www.zohoapis.com/crm/v2.1/Notes"
url = URI(url)
req = Net::HTTP::Post.new(url.request_uri)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
headers={}
headers["Authorization"]="Zoho-oauthtoken 1000.dfa7XXXXXXXXXXXXXXXXXX84f9665840.c176aeXXXXXXXXXXXX13f3d37a84d"
headers&.each { |key, value| req.add_field(key, value) }
request_body = {};
record_array = [];
record_object = {};
record_object["id"]="3524033000000002211";
record_object["Parent_Id"]="3524033000005811001";
record_object["se_module"]="Leads";
record_object["Note_Content"]="3524033000000002211"
record_array = [record_object];
request_body["data"] =record_array;
request_json = request_body.to_json
req.body = request_json.to_s
response=http.request(req)
status_code = response.code.to_i
headers = response.each_header.to_h
print status_code
print headers
unless response.body.nil?
print response.body
end
end
end
UpdateNotes.new.execute
Copiednote1 = Map();
note1.put("Note_Title", "Contacted");
note1.put("Note_Content", "Tracking done. Happy with the customer");
dataList = List();
dataList.add(note1);
params = Map();
params.put("data", dataList);
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v2.1/Leads/692969000000981055/Notes/692969000000994147"
type :PUT
parameters: params.toString()
connection:"crm_oauth_connection"
];
info response;
In the request, "@updatenote.json" contains the sample input data.
Request JSON Keys
- Note_Titlestring, optional
Specify the updated title of the note.
- Note_Contentstring, optional
Specify the updated content of the note.
You must use only Field API names in the input. You can obtain the field API names from Fields metadata API (the value for the key “api_name” for every field).
You can update a maximum of 100 notes per API call.
You can update only two fields of a note: Note_Title and Note_Content. You cannot update values for the following read_only fields: Owner, Modified_Time, Created_Time, Modified_By, and Created_By.
Sample Input
Copied{
"data": [
{
"Note_Title": "Contacted",
"Note_Content": "Tracking done. Happy with the customer"
}
]
}
In the input, specify the field API names of the Notes module along with the corresponding values.
Possible Errors
- INVALID_MODULEHTTP 400
The module name given seems to be invalid
Resolution: You have specified an invalid module name or there is no tab permission, or the module could have been removed from the available modules. Specify a valid module API name. - INVALID_MODULEHTTP 400
The given module is not supported in API
Resolution: The modules such as Documents and Projects are not supported in the current API. (This error will not be shown, once these modules are been supported). Specify a valid module API name. - INVALID_URL_PATTERNHTTP 404
Please check if the URL trying to access is a correct one
Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above. - OAUTH_SCOPE_MISMATCHHTTP 401
Unauthorized
Resolution: Client does not have ZohoCRM.modules.notes.UPDATE scope. Create a new client with valid scope. Refer to scope section above. - NO_PERMISSIONHTTP 403
Permission denied to update notes details
Resolution: The user does not have permission to update notes data. Contact your system administrator. - INTERNAL_ERRORHTTP 500
Internal Server Error
Resolution: Unexpected and unhandled exception in Server. Contact support team. - INVALID_REQUEST_METHODHTTP 400
The http request method type is not a valid one
Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to update notes
Resolution: The user does not have the permission to update notes data. Contact your system administrator. - INVALID_DATAHTTP 400
the related id given seems to be invalid
Resolution: You have specified an incorrect related record ID. Please specify a valid record ID. Refer to Get Related Records API to get valid record IDs. - MANDATORY_NOT_FOUNDHTTP 400
required field not found
Resolution: You have not specified one or more mandatory fields in the input. Refer to Fields Metadata API to know the mandatory fields.
Sample Response
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-07-05T17:13:24+05:30",
"modified_time": "2016-08-08T11:28:41+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "4108880000086001"
},
"id": "410888000000643123",
"created_by": {
"name": "Patricia Boyle",
"id": "4108880000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}