Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()
var success: Bool
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
var resp: CkoHttpResponse? = http.QuickRequest("DELETE", url: "https://domain.com/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002")
if http.LastMethodSuccess == false {
print("\(http.LastErrorText)")
return
}
let sbResponseBody = CkoStringBuilder()
resp!.GetBodySb(sbResponseBody)
let jResp = CkoJsonObject()
jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = false
print("Response Body:")
print("\(jResp.Emit())")
var respStatusCode: Int = resp!.StatusCode.intValue
print("Response Status Code = \(respStatusCode)")
if respStatusCode >= 400 {
print("Response Header:")
print("\(resp!.Header)")
print("Failed.")
resp = nil
return
}
resp = nil
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "watch": [
// {
// "code": "SUCCESS",
// "details": {
// "resource_uri": "https://www.zohoapis.com/crm/v2/Cases",
// "resource_id": "4150868000000002209",
// "channel_id": "1000000068003"
// },
// "message": "Successfully un-subscribed from actions-watch",
// "status": "success"
// },
// {
// "code": "SUCCESS",
// "details": {
// "resource_uri": "https://www.zohoapis.com/crm/v2/Contacts",
// "resource_id": "4150868000000002179",
// "channel_id": "1000000068001"
// },
// "message": "Successfully un-subscribed from actions-watch",
// "status": "success"
// },
// {
// "code": "SUCCESS",
// "details": {
// "resource_uri": "https://www.zohoapis.com/crm/v2/Solutions",
// "resource_id": "4150868000000002211",
// "channel_id": "1000000068001"
// },
// "message": "Successfully un-subscribed from actions-watch",
// "status": "success"
// },
// {
// "code": "SUCCESS",
// "details": {
// "resource_uri": "https://www.zohoapis.com/crm/v2/Price_Books",
// "resource_id": "4150868000000002217",
// "channel_id": "1000000068001"
// },
// "message": "Successfully un-subscribed from actions-watch",
// "status": "success"
// },
// {
// "code": "SUCCESS",
// "details": {
// "resource_uri": "https://www.zohoapis.com/crm/v2/Deals",
// "resource_id": "4150868000000002181",
// "channel_id": "1000000068002"
// },
// "message": "Successfully un-subscribed from actions-watch",
// "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: String?
var Resource_uri: String?
var Resource_id: String?
var Channel_id: String?
var message: String?
var status: String?
var i: Int = 0
var count_i: Int = jResp.SizeOfArray("watch").intValue
while i < count_i {
jResp.I = i
code = jResp.StringOf("watch[i].code")
Resource_uri = jResp.StringOf("watch[i].details.resource_uri")
Resource_id = jResp.StringOf("watch[i].details.resource_id")
Channel_id = jResp.StringOf("watch[i].details.channel_id")
message = jResp.StringOf("watch[i].message")
status = jResp.StringOf("watch[i].status")
i = i + 1
}
}
Curl Command
curl -X DELETE
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002
Postman Collection Item JSON
{
"name": "Disable Notifications",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
},
"description": "To stop all the instant notifications enabled by the user for a channel."
},
"response": [
{
"name": "SUCCESS RESPONSE",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 07:34:04 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"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-ACCESSTOKEN-RESET",
"value": "2021-05-11T14:00:30+05:30"
},
{
"key": "clientVersion",
"value": "4019232"
},
{
"key": "clientsubVersion",
"value": "19804a82a902c9fa618d2b359b97e26a"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "vary",
"value": "accept-encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Content-Language",
"value": "en-US"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000"
}
],
"cookie": [
],
"body": "{\n \"watch\": [\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"resource_uri\": \"https://www.zohoapis.com/crm/v2/Cases\",\n \"resource_id\": \"4150868000000002209\",\n \"channel_id\": \"1000000068003\"\n },\n \"message\": \"Successfully un-subscribed from actions-watch\",\n \"status\": \"success\"\n },\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"resource_uri\": \"https://www.zohoapis.com/crm/v2/Contacts\",\n \"resource_id\": \"4150868000000002179\",\n \"channel_id\": \"1000000068001\"\n },\n \"message\": \"Successfully un-subscribed from actions-watch\",\n \"status\": \"success\"\n },\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"resource_uri\": \"https://www.zohoapis.com/crm/v2/Solutions\",\n \"resource_id\": \"4150868000000002211\",\n \"channel_id\": \"1000000068001\"\n },\n \"message\": \"Successfully un-subscribed from actions-watch\",\n \"status\": \"success\"\n },\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"resource_uri\": \"https://www.zohoapis.com/crm/v2/Price_Books\",\n \"resource_id\": \"4150868000000002217\",\n \"channel_id\": \"1000000068001\"\n },\n \"message\": \"Successfully un-subscribed from actions-watch\",\n \"status\": \"success\"\n },\n {\n \"code\": \"SUCCESS\",\n \"details\": {\n \"resource_uri\": \"https://www.zohoapis.com/crm/v2/Deals\",\n \"resource_id\": \"4150868000000002181\",\n \"channel_id\": \"1000000068002\"\n },\n \"message\": \"Successfully un-subscribed from actions-watch\",\n \"status\": \"success\"\n }\n ]\n}"
},
{
"name": "REQUIRED_PARAM_MISSING",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 07:34:20 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "138"
},
{
"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\": \"channel_ids\"\n },\n \"message\": \"One of the expected parameter is missing\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_URL_PATTERN",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watc?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watc"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 07:34:33 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "131"
},
{
"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-ACCESSTOKEN-RESET",
"value": "2021-05-11T14:00:30+05:30"
},
{
"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_URL_PATTERN\",\n \"details\": {},\n \"message\": \"Please check if the URL trying to access is a correct one\",\n \"status\": \"error\"\n}"
},
{
"name": "AUTHENTICATION_FAILURE",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 07:36:05 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_REQUEST_METHOD",
"originalRequest": {
"method": "COPY",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 11 May 2021 07:41:24 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_REQUEST",
"originalRequest": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/actions/watch?channel_ids=1000000068003,1000000068001,1000000068002",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"actions",
"watch"
],
"query": [
{
"key": "channel_ids",
"value": "1000000068003,1000000068001,1000000068002"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Thu, 13 May 2021 08:25:54 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "192"
},
{
"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\": \"INVALID_REQUEST\",\n \"details\": {},\n \"message\": \"unable to process your request. please verify whether you have entered proper method name, parameter and parameter values.\",\n \"status\": \"error\"\n}"
}
]
}