Back to Collection Items
        #include <C_CkHttp.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;
    const char *Name;
    const char *Id;
    const char *v_Email;
    const char *Modified_Time;
    const char *Sattachments;
    const char *Created_Time;
    const char *Parent_IdName;
    const char *Parent_IdId;
    BOOL Seditable;
    const char *Ssharing_permission;
    const char *Sse_module;
    BOOL Sis_shared_to_client;
    const char *Modified_ByName;
    const char *Modified_ById;
    const char *Modified_ByEmail;
    const char *Ssize;
    const char *Sstate;
    BOOL Svoice_note;
    const char *id;
    const char *Created_ByName;
    const char *Created_ById;
    const char *Created_ByEmail;
    const char *Note_Title;
    const char *Note_Content;
    int Per_page;
    int Count;
    int Page;
    BOOL More_records;
    int i;
    int count_i;
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    http = CkHttp_Create();
    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttp_putAuthToken(http,"<access_token>");
    sbResponseBody = CkStringBuilder_Create();
    success = CkHttp_QuickGetSb(http,"https://domain.com/crm/v2.1/Leads/{{record_id}}/Notes",sbResponseBody);
    if (success == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }
    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);
    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));
    respStatusCode = CkHttp_getLastStatus(http);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttp_lastHeader(http));
        printf("Failed.\n");
        CkHttp_Dispose(http);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }
    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)
    // {
    //   "data": [
    //     {
    //       "Owner": {
    //         "name": "patricia patricia",
    //         "id": "738964000000291009",
    //         "email": "patricia.ss@zylker.com"
    //       },
    //       "Modified_Time": "2021-05-07T06:46:56+00:00",
    //       "$attachments": null,
    //       "Created_Time": "2021-05-07T06:46:56+00:00",
    //       "Parent_Id": {
    //         "name": "sample",
    //         "id": "738964000002131001"
    //       },
    //       "$editable": true,
    //       "$sharing_permission": "full_access",
    //       "$se_module": "Leads",
    //       "$is_shared_to_client": false,
    //       "Modified_By": {
    //         "name": "patricia patricia",
    //         "id": "738964000000291009",
    //         "email": "patricia.ss@zylker.com"
    //       },
    //       "$size": null,
    //       "$state": "save",
    //       "$voice_note": false,
    //       "id": "738964000002131036",
    //       "Created_By": {
    //         "name": "patricia patricia",
    //         "id": "738964000000291009",
    //         "email": "patricia.ss@zylker.com"
    //       },
    //       "Note_Title": null,
    //       "Note_Content": "Test"
    //     }
    //   ],
    //   "info": {
    //     "per_page": 200,
    //     "count": 1,
    //     "page": 1,
    //     "more_records": false
    //   }
    // }
    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
    Per_page = CkJsonObject_IntOf(jResp,"info.per_page");
    Count = CkJsonObject_IntOf(jResp,"info.count");
    Page = CkJsonObject_IntOf(jResp,"info.page");
    More_records = CkJsonObject_BoolOf(jResp,"info.more_records");
    i = 0;
    count_i = CkJsonObject_SizeOfArray(jResp,"data");
    while (i < count_i) {
        CkJsonObject_putI(jResp,i);
        Name = CkJsonObject_stringOf(jResp,"data[i].Owner.name");
        Id = CkJsonObject_stringOf(jResp,"data[i].Owner.id");
        v_Email = CkJsonObject_stringOf(jResp,"data[i].Owner.email");
        Modified_Time = CkJsonObject_stringOf(jResp,"data[i].Modified_Time");
        Sattachments = CkJsonObject_stringOf(jResp,"data[i].$attachments");
        Created_Time = CkJsonObject_stringOf(jResp,"data[i].Created_Time");
        Parent_IdName = CkJsonObject_stringOf(jResp,"data[i].Parent_Id.name");
        Parent_IdId = CkJsonObject_stringOf(jResp,"data[i].Parent_Id.id");
        Seditable = CkJsonObject_BoolOf(jResp,"data[i].$editable");
        Ssharing_permission = CkJsonObject_stringOf(jResp,"data[i].$sharing_permission");
        Sse_module = CkJsonObject_stringOf(jResp,"data[i].$se_module");
        Sis_shared_to_client = CkJsonObject_BoolOf(jResp,"data[i].$is_shared_to_client");
        Modified_ByName = CkJsonObject_stringOf(jResp,"data[i].Modified_By.name");
        Modified_ById = CkJsonObject_stringOf(jResp,"data[i].Modified_By.id");
        Modified_ByEmail = CkJsonObject_stringOf(jResp,"data[i].Modified_By.email");
        Ssize = CkJsonObject_stringOf(jResp,"data[i].$size");
        Sstate = CkJsonObject_stringOf(jResp,"data[i].$state");
        Svoice_note = CkJsonObject_BoolOf(jResp,"data[i].$voice_note");
        id = CkJsonObject_stringOf(jResp,"data[i].id");
        Created_ByName = CkJsonObject_stringOf(jResp,"data[i].Created_By.name");
        Created_ById = CkJsonObject_stringOf(jResp,"data[i].Created_By.id");
        Created_ByEmail = CkJsonObject_stringOf(jResp,"data[i].Created_By.email");
        Note_Title = CkJsonObject_stringOf(jResp,"data[i].Note_Title");
        Note_Content = CkJsonObject_stringOf(jResp,"data[i].Note_Content");
        i = i + 1;
    }
    CkHttp_Dispose(http);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);
    }
        Curl Command
        curl -X GET
	-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2.1/Leads/{{record_id}}/Notes
        Postman Collection Item JSON
        {
  "name": "Notes",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}/Notes",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2.1",
        "Leads",
        "{{record_id}}",
        "Notes"
      ]
    },
    "description": "To get the notes associated with a Lead"
  },
  "response": [
    {
      "name": "SUCCESS RESPONSE",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Leads/738964000002131001/Notes",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Leads",
            "738964000002131001",
            "Notes"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Fri, 07 May 2021 06:46:58 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "735"
        },
        {
          "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-07T07:46:12+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4016256"
        },
        {
          "key": "clientsubVersion",
          "value": "8ef7aa3133ce0e105307c407d89b23d9"
        },
        {
          "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    \"data\": [\n        {\n            \"Owner\": {\n                \"name\": \"patricia patricia\",\n                \"id\": \"738964000000291009\",\n                \"email\": \"patricia.ss@zylker.com\"\n            },\n            \"Modified_Time\": \"2021-05-07T06:46:56+00:00\",\n            \"$attachments\": null,\n            \"Created_Time\": \"2021-05-07T06:46:56+00:00\",\n            \"Parent_Id\": {\n                \"name\": \"sample\",\n                \"id\": \"738964000002131001\"\n            },\n            \"$editable\": true,\n            \"$sharing_permission\": \"full_access\",\n            \"$se_module\": \"Leads\",\n            \"$is_shared_to_client\": false,\n            \"Modified_By\": {\n                \"name\": \"patricia patricia\",\n                \"id\": \"738964000000291009\",\n                \"email\": \"patricia.ss@zylker.com\"\n            },\n            \"$size\": null,\n            \"$state\": \"save\",\n            \"$voice_note\": false,\n            \"id\": \"738964000002131036\",\n            \"Created_By\": {\n                \"name\": \"patricia patricia\",\n                \"id\": \"738964000000291009\",\n                \"email\": \"patricia.ss@zylker.com\"\n            },\n            \"Note_Title\": null,\n            \"Note_Content\": \"Test\"\n        }\n    ],\n    \"info\": {\n        \"per_page\": 200,\n        \"count\": 1,\n        \"page\": 1,\n        \"more_records\": false\n    }\n}"
    },
    {
      "name": "INVALID_MODULE",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Lead/738964000002131001/Notes",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Lead",
            "738964000002131001",
            "Notes"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Fri, 07 May 2021 06:47:31 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": "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-07T07:46:12+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4016256"
        },
        {
          "key": "clientsubVersion",
          "value": "8ef7aa3133ce0e105307c407d89b23d9"
        },
        {
          "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        \"resource_path_index\": 0\n    },\n    \"message\": \"the module name given seems to be invalid\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "INVALID_REQUEST_METHOD",
      "originalRequest": {
        "method": "COPY",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Lead/738964000002131001/Notes",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Lead",
            "738964000002131001",
            "Notes"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Fri, 07 May 2021 06:47:53 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": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Lead/738964000002131001/Notes",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Lead",
            "738964000002131001",
            "Notes"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Fri, 07 May 2021 06:48:14 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",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}/Notes",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Leads",
            "{{record_id}}",
            "Notes"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Thu, 13 May 2021 06:52:50 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}"
    }
  ]
}