Chilkat Online Tools

delphiDll / Zoho CRM REST APIs / Leads

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
sbRequestBody: HCkStringBuilder;
resp: HCkHttpResponse;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
created_time: PWideChar;
modified_time: PWideChar;
name: PWideChar;
Name: PWideChar;
Id: PWideChar;
id: PWideChar;
created_byName: PWideChar;
created_byId: PWideChar;
Count: Integer;
Allowed_count: Integer;
i: Integer;
count_i: Integer;

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

http := CkHttp_Create();

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

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

// {
//   "tags": [
//     {
//       "id": "{{tag_id}}",
//       "name": "Passive"
//     },
//     {
//       "id": "{{tag_id}}",
//       "name": "Active"
//     }
//   ]
// }

json := CkJsonObject_Create();
CkJsonObject_UpdateString(json,'tags[0].id','{{tag_id}}');
CkJsonObject_UpdateString(json,'tags[0].name','Passive');
CkJsonObject_UpdateString(json,'tags[1].id','{{tag_id}}');
CkJsonObject_UpdateString(json,'tags[1].name','Active');

// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,'<access_token>');

sbRequestBody := CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);

resp := CkHttp_PTextSb(http,'PUT','https://domain.com/crm/v2/settings/tags?module=Leads',sbRequestBody,'utf-8','application/json',False,False);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

sbResponseBody := CkStringBuilder_Create();
CkHttpResponse_GetBodySb(resp,sbResponseBody);

jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);

Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));

respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttpResponse__header(resp));
    Memo1.Lines.Add('Failed.');
    CkHttpResponse_Dispose(resp);
    Exit;
  end;
CkHttpResponse_Dispose(resp);

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

// {
//   "tags": [
//     {
//       "created_time": "2021-05-07T12:40:30+00:00",
//       "modified_time": "2021-05-07T12:40:30+00:00",
//       "name": "test",
//       "modified_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       },
//       "id": "738964000002130345",
//       "created_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       }
//     },
//     {
//       "created_time": "2021-05-12T06:33:15+00:00",
//       "modified_time": "2021-05-12T06:33:15+00:00",
//       "name": "Nurturing Lead2",
//       "modified_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       },
//       "id": "738964000002152055",
//       "created_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       }
//     },
//     {
//       "created_time": "2021-05-12T06:33:15+00:00",
//       "modified_time": "2021-05-12T06:33:15+00:00",
//       "name": "Qualifies Lead2",
//       "modified_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       },
//       "id": "738964000002152056",
//       "created_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       }
//     },
//     {
//       "created_time": "2021-05-12T06:42:36+00:00",
//       "modified_time": "2021-05-12T06:42:36+00:00",
//       "name": "Tag1",
//       "modified_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       },
//       "id": "738964000002152073",
//       "created_by": {
//         "name": "Patricia Boyle",
//         "id": "738964000000291009"
//       }
//     }
//   ],
//   "info": {
//     "count": 4,
//     "allowed_count": 100
//   }
// }

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

Count := CkJsonObject_IntOf(jResp,'info.count');
Allowed_count := CkJsonObject_IntOf(jResp,'info.allowed_count');
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'tags');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    created_time := CkJsonObject__stringOf(jResp,'tags[i].created_time');
    modified_time := CkJsonObject__stringOf(jResp,'tags[i].modified_time');
    name := CkJsonObject__stringOf(jResp,'tags[i].name');
    Name := CkJsonObject__stringOf(jResp,'tags[i].modified_by.name');
    Id := CkJsonObject__stringOf(jResp,'tags[i].modified_by.id');
    id := CkJsonObject__stringOf(jResp,'tags[i].id');
    created_byName := CkJsonObject__stringOf(jResp,'tags[i].created_by.name');
    created_byId := CkJsonObject__stringOf(jResp,'tags[i].created_by.id');
    i := i + 1;
  end;

CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-d '{
    "tags": [
        {
            "id": "{{tag_id}}",
            "name": "Passive"
        },
        {
            "id": "{{tag_id}}",
            "name": "Active"
        }
    ]
}'
https://domain.com/crm/v2/settings/tags?module=Leads

Postman Collection Item JSON

{
  "name": "Leads",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "PUT",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Passive\"\n        },\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Active\"\n        }\n    ]\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2",
        "settings",
        "tags"
      ],
      "query": [
        {
          "key": "module",
          "value": "Leads"
        }
      ]
    },
    "description": "To update tags."
  },
  "response": [
    {
      "name": "P1: module",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Passive\"\n        },\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Active\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Thu, 13 May 2021 09:05:23 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-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-05-13T09:52:40+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4031107"
        },
        {
          "key": "clientsubVersion",
          "value": "113b962796fc62946d9303284a64efab"
        },
        {
          "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=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"tags\": [\n        {\n            \"created_time\": \"2021-05-07T12:40:30+00:00\",\n            \"modified_time\": \"2021-05-07T12:40:30+00:00\",\n            \"name\": \"test\",\n            \"modified_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            },\n            \"id\": \"738964000002130345\",\n            \"created_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            }\n        },\n        {\n            \"created_time\": \"2021-05-12T06:33:15+00:00\",\n            \"modified_time\": \"2021-05-12T06:33:15+00:00\",\n            \"name\": \"Nurturing Lead2\",\n            \"modified_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            },\n            \"id\": \"738964000002152055\",\n            \"created_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            }\n        },\n        {\n            \"created_time\": \"2021-05-12T06:33:15+00:00\",\n            \"modified_time\": \"2021-05-12T06:33:15+00:00\",\n            \"name\": \"Qualifies Lead2\",\n            \"modified_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            },\n            \"id\": \"738964000002152056\",\n            \"created_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            }\n        },\n        {\n            \"created_time\": \"2021-05-12T06:42:36+00:00\",\n            \"modified_time\": \"2021-05-12T06:42:36+00:00\",\n            \"name\": \"Tag1\",\n            \"modified_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            },\n            \"id\": \"738964000002152073\",\n            \"created_by\": {\n                \"name\": \"Patricia Boyle\",\n                \"id\": \"738964000000291009\"\n            }\n        }\n    ],\n    \"info\": {\n        \"count\": 4,\n        \"allowed_count\": 100\n    }\n}"
    },
    {
      "name": "SUCCESS RESPONSE",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": \"Passive\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:35:49 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "342"
        },
        {
          "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-05-12T07:15:06+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4027076"
        },
        {
          "key": "clientsubVersion",
          "value": "748ecbe82ec7e144b66ee25f264bbd88"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"tags\": [\n        {\n            \"code\": \"SUCCESS\",\n            \"details\": {\n                \"created_time\": \"2021-05-07T12:38:01+00:00\",\n                \"modified_time\": \"2021-05-12T06:35:55+00:00\",\n                \"modified_by\": {\n                    \"name\": \"Patricia Boyle\",\n                    \"id\": \"738964000000291009\"\n                },\n                \"id\": \"738964000002130339\",\n                \"created_by\": {\n                    \"name\": \"Patricia Boyle\",\n                    \"id\": \"738964000000291009\"\n                }\n            },\n            \"message\": \"tags updated successfully\",\n            \"status\": \"success\"\n        }\n    ]\n}"
    },
    {
      "name": "INVALID_MODULE",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": \"Passive\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Lead",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Lead"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:36:14 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-05-12T07:15:06+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4027076"
        },
        {
          "key": "clientsubVersion",
          "value": "748ecbe82ec7e144b66ee25f264bbd88"
        },
        {
          "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_URL_PATTERN",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": \"Passive\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tag?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tag"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:36:30 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-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-05-12T07:15:06+00:00"
        },
        {
          "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": "INVALID_REQUEST_METHOD",
      "originalRequest": {
        "method": "COPY",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": \"Passive\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tag?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tag"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:36:47 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": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": \"Passive\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tag?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tag"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:37:06 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": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130339\",\n            \"name\": $$$\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:37:49 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "136"
        },
        {
          "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-05-12T07:15:06+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4027076"
        },
        {
          "key": "clientsubVersion",
          "value": "748ecbe82ec7e144b66ee25f264bbd88"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"tags\": [\n        {\n            \"code\": \"INVALID_DATA\",\n            \"details\": {\n                \"api_name\": \"name\"\n            },\n            \"message\": \"special characters found in the given name\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "DUPLICATE_DATA",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"738964000002130340\",\n            \"name\": \"Nurturing Lead\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:38:29 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "136"
        },
        {
          "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-05-12T07:15:06+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4027076"
        },
        {
          "key": "clientsubVersion",
          "value": "748ecbe82ec7e144b66ee25f264bbd88"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"tags\": [\n        {\n            \"code\": \"DUPLICATE_DATA\",\n            \"details\": {\n                \"api_name\": \"name\",\n                \"id\": \"738964000002130339\"\n            },\n            \"message\": \"duplicate data\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "MANDATORY_NOT_FOUND",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"name\": \"Nurturing Lead\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:38:55 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "123"
        },
        {
          "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-05-12T07:15:06+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4027076"
        },
        {
          "key": "clientsubVersion",
          "value": "748ecbe82ec7e144b66ee25f264bbd88"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"tags\": [\n        {\n            \"code\": \"MANDATORY_NOT_FOUND\",\n            \"details\": {\n                \"api_name\": \"id\"\n            },\n            \"message\": \"required field not found\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "REQUIRED_PARAM_MISSING",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"name\": \"Nurturing Lead\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:39:07 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "133"
        },
        {
          "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\": \"module\"\n    },\n    \"message\": \"One of the expected parameter is missing\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "UNABLE_TO_PARSE_DATA_TYPE",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Passive\"\n        },\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Active\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Wed, 12 May 2021 06:39:21 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "136"
        },
        {
          "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\": \"UNABLE_TO_PARSE_DATA_TYPE\",\n    \"details\": {},\n    \"message\": \"either the request body or parameters is in wrong format\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "OAUTH_SCOPE_MISMATCH",
      "originalRequest": {
        "method": "PUT",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"tags\": [\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Passive\"\n        },\n        {\n            \"id\": \"{{tag_id}}\",\n            \"name\": \"Active\"\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/settings/tags?module=Leads",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "settings",
            "tags"
          ],
          "query": [
            {
              "key": "module",
              "value": "Leads"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Thu, 13 May 2021 08:32:30 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}"
    }
  ]
}