I want to use the Zoho Desk API to merge duplicated contacts. I wrote the following Deluge function to do this:- merge_contacts_api_payloads = List();
merge_contacts_api_payloads.insert({'ids':{'842454000000989001','842454000002232455'},'source':{'firstName':'842454000000989001','lastName':'842454000000989001','email':'842454000000989001','secondaryEmail':'842454000000989001','accountId':'842454000000989001','twitter':'842454000000989001','facebook':'842454000000989001','phone':'842454000000989001','mobile':'842454000000989001','type':'842454000000989001','title':'842454000000989001','street':'842454000000989001','city':'842454000000989001','state':'842454000000989001','zip':'842454000000989001','country':'842454000000989001','description':'842454000000989001'}});
newLine = hexToText("0A");
for each payload in merge_contacts_api_payloads
{
source_id = payload.get("ids").get(0);
info "source_id = " + source_id;
info newLine;
request_url = "https://desk.zoho.com/api/v1/contacts/" + source_id + "/merge";
info "request_url = " + request_url;
info newLine;
info "payload = " + payload;
info newLine;
response = invokeurl
[
url :request_url
type :POST
parameters:payload.toString()
connection:"taskmaker"
];
info "response = " + response;
info newLine;
}
I get the following error message in response:
- {"errorCode":"INVALID_DATA","message":"The data is invalid due to
validation
restrictions","errors":[{"fieldName":"/ids","errorType":"invalid","errorMessage":""}]}
I have verified that the contact IDs are correct. What do I need to do to make this work?