Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcCode
LOCAL lcId
LOCAL lcMessage
LOCAL lcStatus
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* 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}}"
* }
* ]
* }
* ]
* }
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("data[0].id","{{record_id1}}")
loJson.UpdateString("data[0].Territories[0].id","{{territory_id1}}")
loJson.UpdateString("data[0].Territories[1].id","{{territory_id2}}")
loJson.UpdateString("data[1].id","{{record_id2}}")
loJson.UpdateString("data[1].Territories[0].id","{{territory_id1}}")
loJson.UpdateString("data[1].Territories[1].id","{{territory_id2}}")
* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loResp = loHttp.PostJson3("https://domain.com/crm/v2.1/Accounts/actions/assign_territories","application/json",loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loResp.Header
? "Failed."
RELEASE loResp
RELEASE loHttp
RELEASE loJson
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
RELEASE loResp
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "data": [
* {
* "code": "SUCCESS",
* "details": {
* "id": "4150868000004818104"
* },
* "message": "the territories data updated successfully",
* "status": "success"
* },
* {
* "code": "SUCCESS",
* "details": {
* "id": "4150868000004818029"
* },
* "message": "the territories data updated 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
lnCount_i = loJResp.SizeOfArray("data")
DO WHILE i < lnCount_i
loJResp.I = i
lcCode = loJResp.StringOf("data[i].code")
lcId = loJResp.StringOf("data[i].details.id")
lcMessage = loJResp.StringOf("data[i].message")
lcStatus = loJResp.StringOf("data[i].status")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loJson
RELEASE loSbResponseBody
RELEASE loJResp
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/assign_territories
Postman Collection Item JSON
{
"name": "Assign 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/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
},
"description": "To assign territories 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/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Contacts",
"actions",
"assign_territories"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:35:25 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "272"
},
{
"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-03T16:58:36+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 territories data updated successfully\",\n \"status\": \"success\"\n },\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"id\": \"4150868000004818029\"\n },\n \"message\": \"the territories data updated successfully\",\n \"status\": \"success\"\n }\n ]\n}"
},
{
"name": "INVALID_REQUEST_METHOD",
"originalRequest": {
"method": "GET",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492026\",\n \"Territories\": [\n {\n \"id\": \"4150868000005232029\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n },\n {\n \"id\": \"4150868000002492050\",\n \"Territories\": [\n {\n \"id\": \"4150868000005232029\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:14:35 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": "INVALID_DATA (Record ID)",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"41508680000024920\",\n \"Territories\": [\n {\n \"id\": \"4150868000005232029\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n },\n {\n \"id\": \"41508680000024920506\",\n \"Territories\": [\n {\n \"id\": \"4150868000005232029\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:17:48 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "309"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Set-Cookie",
"value": "1a99390653=12a340a9c5d3e8d49c85c68bd2161d0b; Path=/"
},
{
"key": "Set-Cookie",
"value": "crmcsr=2c37198e-ea63-4e3c-bcee-b4adda5d60a2;path=/;SameSite=None;Secure;priority=high"
},
{
"key": "Set-Cookie",
"value": "_zcsr_tmp=2c37198e-ea63-4e3c-bcee-b4adda5d60a2;path=/;SameSite=Strict;Secure;priority=high"
},
{
"key": "Set-Cookie",
"value": "listview_enabled=true;Path=/"
},
{
"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-ACCESSTOKEN-RESET",
"value": "2021-05-03T15:57:57+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 \"expected_data_type\": \"bigint\",\n \"api_name\": \"id\",\n \"json_path\": \"$.data[1].id\"\n },\n \"message\": \"invalid data\",\n \"status\": \"error\"\n }\n ]\n}"
},
{
"name": "INVALID_DATA (Territory ID)",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"415086800000523202\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:20:59 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-03T15:57:57+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": "MULTI-STATUS ERROR",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"41508680000024920\",\n \"Territories\": [\n {\n \"id\": \"415086800000278200\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n },\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"4150868000005232029\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Multi-Status (WebDAV) (RFC 4918)",
"code": 207,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:19:37 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "289"
},
{
"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-03T15:57:57+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\": \"SUCCESS\",\n \"details\": {\n \"id\": \"4150868000002492075\"\n },\n \"message\": \"the territories data updated successfully\",\n \"status\": \"success\"\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\": \"415086800000523202\"\n },\n {\n \"id\": \"4150868000005232023\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:21:57 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-03T15:57:57+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\": \"4150868000002492075\",\n \"Territories\": []\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:22:49 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-03T15:57:57+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}"
},
{
"name": "ALREADY_USED",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"4150868000004822544\"\n },\n {\n \"id\": \"4150868000004822544\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:24:03 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "162"
},
{
"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-03T15:57:57+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\": \"ALREADY_USED\",\n \"details\": {\n \"api_name\": \"id\",\n \"json_path\": \"$.data[0].Territories[1].id\"\n },\n \"message\": \"duplicate territory id found\",\n \"status\": \"error\"\n }\n ]\n}"
},
{
"name": "DUPLICATE_DATA",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"4150868000004822544\"\n },\n {\n \"id\": \"4150868000000236307\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:25:13 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "185"
},
{
"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-03T15:57:57+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\": \"DUPLICATE_DATA\",\n \"details\": {\n \"api_name\": \"id\",\n \"json_path\": \"$.data[0].Territories[0].id\"\n },\n \"message\": \"Given Territory id already exists for that record\",\n \"status\": \"error\"\n }\n ]\n}"
},
{
"name": "AUTHENTICATION_FAILURE",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"4150868000004822544\"\n },\n {\n \"id\": \"4150868000000236307\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:25:39 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": "OAUTH_SCOPE_MISMATCH",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"4150868000002492075\",\n \"Territories\": [\n {\n \"id\": \"4150868000004822544\"\n },\n {\n \"id\": \"4150868000000236307\"\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{api-domain}}/crm/v2.1/Accounts/actions/assign_territories",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Accounts",
"actions",
"assign_territories"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 10:26:35 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}"
}
]
}