Node.js / Zoho CRM REST APIs / Remove Contact Role from a Specific Deal
Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
// resp: HttpResponse
var resp = http.QuickRequest("DELETE","https://domain.com/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050");
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
var sbResponseBody = new chilkat.StringBuilder();
resp.GetBodySb(sbResponseBody);
var jResp = new chilkat.JsonObject();
jResp.LoadSb(sbResponseBody);
jResp.EmitCompact = false;
console.log("Response Body:");
console.log(jResp.Emit());
var respStatusCode = resp.StatusCode;
console.log("Response Status Code = " + respStatusCode);
if (respStatusCode >= 400) {
console.log("Response Header:");
console.log(resp.Header);
console.log("Failed.");
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "data": [
// {
// "code": "SUCCESS",
// "details": {
// "id": "738964000002224050"
// },
// "message": "relation removed",
// "status": "success"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
var code;
var Id;
var message;
var status;
var i = 0;
var count_i = jResp.SizeOfArray("data");
while (i < count_i) {
jResp.I = i;
code = jResp.StringOf("data[i].code");
Id = jResp.StringOf("data[i].details.id");
message = jResp.StringOf("data[i].message");
status = jResp.StringOf("data[i].status");
i = i+1;
}
}
chilkatExample();
Curl Command
curl -X DELETE
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050
Postman Collection Item JSON
{
"name": "Remove Contact Role from a Specific Deal",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"response": [
{
"name": "SUCCESS RESPONSE",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:51:46 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "115"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-06-19T13:46:59+00:00"
},
{
"key": "clientVersion",
"value": "4129594"
},
{
"key": "clientsubVersion",
"value": "e19f9ad0a8e8124688b3545413dd1f46"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "Content-Language",
"value": "en-US"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"id\": \"738964000002224050\"\n },\n \"message\": \"relation removed\",\n \"status\": \"success\"\n }\n ]\n}"
},
{
"name": "INVALID_MODULE",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deal/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deal",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:52:49 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "110"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-06-19T13:46:59+00:00"
},
{
"key": "clientVersion",
"value": "4129594"
},
{
"key": "clientsubVersion",
"value": "e19f9ad0a8e8124688b3545413dd1f46"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_MODULE\",\n \"details\": {},\n \"message\": \"the module name given seems to be invalid\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_REQUEST_METHOD",
"originalRequest": {
"method": "COPY",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:53:16 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "124"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Frame-Options",
"value": "deny"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_REQUEST_METHOD\",\n \"details\": {},\n \"message\": \"The http request method type is not a valid one\",\n \"status\": \"error\"\n}"
},
{
"name": "AUTHENTICATION_FAILURE",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:53:35 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "98"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Download-Options",
"value": "noopen"
}
],
"cookie": [
],
"body": "{\n \"code\": \"AUTHENTICATION_FAILURE\",\n \"details\": {},\n \"message\": \"Authentication failed\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_DATA",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "Accepted",
"code": 202,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:53:50 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "120"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-06-19T13:46:59+00:00"
},
{
"key": "clientVersion",
"value": "4129594"
},
{
"key": "clientsubVersion",
"value": "e19f9ad0a8e8124688b3545413dd1f46"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"code\": \"INVALID_DATA\",\n \"details\": {\n \"id\": \"738964000002224050\"\n },\n \"message\": \"relation not found\",\n \"status\": \"error\"\n }\n ]\n}"
},
{
"name": "INVALID_DATA",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/73896400000191904/Contact_Roles/738964000002224050",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"73896400000191904",
"Contact_Roles",
"738964000002224050"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:54:55 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "107"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-06-19T13:46:59+00:00"
},
{
"key": "clientVersion",
"value": "4129594"
},
{
"key": "clientsubVersion",
"value": "e19f9ad0a8e8124688b3545413dd1f46"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_DATA\",\n \"details\": {},\n \"message\": \"the related id given seems to be invalid\",\n \"status\": \"error\"\n}"
},
{
"name": "REQUIRED_PARAM_MISSING",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2/Deals/738964000001919043/Contact_Roles",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"Deals",
"738964000001919043",
"Contact_Roles"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Sat, 19 Jun 2021 12:55:22 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "130"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Download-Options",
"value": "noopen"
}
],
"cookie": [
],
"body": "{\n \"code\": \"REQUIRED_PARAM_MISSING\",\n \"details\": {\n \"param\": \"ids\"\n },\n \"message\": \"One of the expected parameter is missing\",\n \"status\": \"error\"\n}"
}
]
}