Chilkat Online Tools

PowerBuilder / Zoho CRM REST APIs / Remove Territories

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Code
string ls_Id
string ls_Message
string ls_Status
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "data": [
//     {
//       "id": "{{record_ID1}}",
//       "Territories": [
//         {
//           "id": "{{territory_ID1}}"
//         },
//         {
//           "id": "{{territory_ID2}}"
//         }
//       ]
//     },
//     {
//       "id": "{{record_ID2}}",
//       "Territories": [
//         {
//           "id": "{{territory_ID1}}"
//         },
//         {
//           "id": "{{territory_ID2}}"
//         }
//       ]
//     }
//   ]
// }

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.UpdateString("data[0].id","{{record_ID1}}")
loo_Json.UpdateString("data[0].Territories[0].id","{{territory_ID1}}")
loo_Json.UpdateString("data[0].Territories[1].id","{{territory_ID2}}")
loo_Json.UpdateString("data[1].id","{{record_ID2}}")
loo_Json.UpdateString("data[1].Territories[0].id","{{territory_ID1}}")
loo_Json.UpdateString("data[1].Territories[1].id","{{territory_ID2}}")

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"

loo_Resp = loo_Http.PostJson3("https://domain.com/crm/v2.1/Accounts/actions/remove_territories","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_Json
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "data": [
//     {
//       "code": "SUCCESS",
//       "details": {
//         "id": "4150868000004818104"
//       },
//       "message": "the terriroies data removed successfully",
//       "status": "success"
//     },
//     {
//       "code": "SUCCESS",
//       "details": {
//         "id": "4150868000004818029"
//       },
//       "message": "the terriroies data removed successfully",
//       "status": "success"
//     }
//   ]
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

i = 0
li_Count_i = loo_JResp.SizeOfArray("data")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Code = loo_JResp.StringOf("data[i].code")
    ls_Id = loo_JResp.StringOf("data[i].details.id")
    ls_Message = loo_JResp.StringOf("data[i].message")
    ls_Status = loo_JResp.StringOf("data[i].status")
    i = i + 1
loop


destroy loo_Http
destroy loo_Json
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
    "data": [
        {
            "id": "{{record_ID1}}",
            "Territories": [
                {
                    "id": "{{territory_ID1}}"
                },
                {
                    "id": "{{territory_ID2}}"
                }
            ]
        },
        {
            "id": "{{record_ID2}}",
            "Territories": [
                {
                    "id": "{{territory_ID1}}"
                },
                {
                    "id": "{{territory_ID2}}"
                }
            ]
        }
    ]
}'
https://domain.com/crm/v2.1/Accounts/actions/remove_territories

Postman Collection Item JSON

{
  "name": "Remove Territories",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"data\": [\n        {\n            \"id\": \"{{record_ID1}}\",\n            \"Territories\": [\n                {\n                    \"id\": \"{{territory_ID1}}\"\n                },\n                {\n                    \"id\": \"{{territory_ID2}}\"\n                }\n            ]\n        },\n        {\n            \"id\": \"{{record_ID2}}\",\n            \"Territories\": [\n                {\n                    \"id\": \"{{territory_ID1}}\"\n                },\n                {\n                    \"id\": \"{{territory_ID2}}\"\n                }\n            ]\n        }\n    ]\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2.1",
        "Accounts",
        "actions",
        "remove_territories"
      ]
    },
    "description": "To remove territories assigned to multiple records or a single record."
  },
  "response": [
    {
      "name": "SUCCESS RESPONSE",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        },\n        {\n            \"id\": \"4150868000004818029\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Contacts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Contacts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:23:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "270"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "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\": \"4150868000004818104\"\n            },\n            \"message\": \"the terriroies data removed successfully\",\n            \"status\": \"success\"\n        },\n        {\n            \"code\": \"SUCCESS\",\n            \"details\": {\n                \"id\": \"4150868000004818029\"\n            },\n            \"message\": \"the terriroies data removed successfully\",\n            \"status\": \"success\"\n        }\n    ]\n}"
    },
    {
      "name": "OAUTH_SCOPE_MISMATCH",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        },\n        {\n            \"id\": \"4150868000004818029\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Accounts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:13:27 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "113"
        },
        {
          "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\": \"OAUTH_SCOPE_MISMATCH\",\n    \"details\": {},\n    \"message\": \"invalid oauth scope to access this URL\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "INVALID_REQUEST_METHOD",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        },\n        {\n            \"id\": \"4150868000004818029\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Accounts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:16:22 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": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        },\n        {\n            \"id\": \"4150868000004818029\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Accounts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:16:44 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 (Record ID)",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        },\n        {\n            \"id\": \"4150868000004818029\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Accounts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:18:38 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "306"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "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                \"api_name\": \"id\",\n                \"json_path\": \"$.data[0].id\"\n            },\n            \"message\": \"The record Id given seems to be invalid\",\n            \"status\": \"error\"\n        },\n        {\n            \"code\": \"INVALID_DATA\",\n            \"details\": {\n                \"api_name\": \"id\",\n                \"json_path\": \"$.data[1].id\"\n            },\n            \"message\": \"The record Id given seems to be invalid\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "INVALID_DATA (Territory ID)",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": [\n                {\n                    \"id\": \"415086800000325900\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Contacts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Contacts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:23:45 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "166"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "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                \"api_name\": \"id\",\n                \"json_path\": \"$.data[0].Territories[0].id\"\n            },\n            \"message\": \"the id given seems to be invalid\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "NOT_ALLOWED",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000003247001\",\n            \"Territories\": [\n                {\n                    \"id\": \"4150868000003259003\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Accounts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Accounts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:20:28 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "196"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"data\": [\n        {\n            \"code\": \"NOT_ALLOWED\",\n            \"details\": {\n                \"api_name\": \"id\",\n                \"json_path\": \"$.data[0].Territories[0].id\"\n            },\n            \"message\": \"Territory id which you are trying to remove was system assigned\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "MANDATORY_NOT_FOUND (Record ID)",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"Territories\": [\n                {\n                    \"id\": \"415086800000325900\"\n                },\n                {\n                    \"id\": \"4150868000001390007\"\n                }\n            ]\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Contacts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Contacts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:24:17 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "166"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"data\": [\n        {\n            \"code\": \"MANDATORY_NOT_FOUND\",\n            \"details\": {\n                \"api_name\": \"id\",\n                \"json_path\": \"$.data[0].id\"\n            },\n            \"message\": \"One of the expected parameter is missing\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "MANDATORY_NOT_FOUND (Territory ID)",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"id\": \"4150868000004818104\",\n            \"Territories\": []\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Contacts/actions/remove_territories",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Contacts",
            "actions",
            "remove_territories"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Mon, 03 May 2021 11:24:41 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "168"
        },
        {
          "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": "Set-Cookie",
          "value": "listview_enabled=true;Path=/"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-03T17:48:32+05:30"
        },
        {
          "key": "clientVersion",
          "value": "4000204"
        },
        {
          "key": "clientsubVersion",
          "value": "9875f452294f1c73e02cebb497ee077e"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"data\": [\n        {\n            \"code\": \"MANDATORY_NOT_FOUND\",\n            \"details\": {\n                \"api_name\": \"Territories\",\n                \"json_path\": \"$.data[0].Territories\"\n            },\n            \"message\": \"required field not found\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    }
  ]
}