Back to Collection Items
        #include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    HCkStringBuilderW sbRequestBody;
    HCkHttpResponseW resp;
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    http = CkHttpW_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.
    // {
    //   "documentTypeCodeName": "creditupdated",
    //   "namePrimaryLang": "CreditEn",
    //   "nameSecondaryLang": "CreditAr",
    //   "descriptionPrimaryLang": "Des-creditEn",
    //   "descriptionSecondaryLang": "Des-creditAr",
    //   "activeFrom": "2020-06-09T07:38:54.836Z"
    // }
    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"documentTypeCodeName",L"creditupdated");
    CkJsonObjectW_UpdateString(json,L"namePrimaryLang",L"CreditEn");
    CkJsonObjectW_UpdateString(json,L"nameSecondaryLang",L"CreditAr");
    CkJsonObjectW_UpdateString(json,L"descriptionPrimaryLang",L"Des-creditEn");
    CkJsonObjectW_UpdateString(json,L"descriptionSecondaryLang",L"Des-creditAr");
    CkJsonObjectW_UpdateString(json,L"activeFrom",L"2020-06-09T07:38:54.836Z");
    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttpW_putAuthToken(http,L"<access_token>");
    CkHttpW_SetRequestHeader(http,L"Accept-Language",L"ar");
    sbRequestBody = CkStringBuilderW_Create();
    CkJsonObjectW_EmitSb(json,sbRequestBody);
    resp = CkHttpResponseW_Create();
    success = CkHttpW_HttpSb(http,L"GET",L"https://domain.com/api/v1/documenttypes",sbRequestBody,L"utf-8",L"application/json",resp);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkStringBuilderW_Dispose(sbRequestBody);
        CkHttpResponseW_Dispose(resp);
        return;
    }
    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkStringBuilderW_Dispose(sbRequestBody);
    CkHttpResponseW_Dispose(resp);
    }
        Curl Command
        curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "Accept-Language: ar"
	-d '{
    "documentTypeCodeName": "creditupdated",
    "namePrimaryLang": "CreditEn",
    "nameSecondaryLang": "CreditAr",
    "descriptionPrimaryLang": "Des-creditEn",
    "descriptionSecondaryLang": "Des-creditAr",
    "activeFrom": "2020-06-09T07:38:54.836Z"
}'
https://domain.com/api/v1/documenttypes
        Postman Collection Item JSON
        {
  "name": "2. Get Document Types",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{generatedAccessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
      {
        "key": "Accept-Language",
        "value": "ar",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\r\n    \"documentTypeCodeName\": \"creditupdated\",\r\n    \"namePrimaryLang\": \"CreditEn\",\r\n    \"nameSecondaryLang\": \"CreditAr\",\r\n    \"descriptionPrimaryLang\": \"Des-creditEn\",\r\n    \"descriptionSecondaryLang\": \"Des-creditAr\",\r\n    \"activeFrom\": \"2020-06-09T07:38:54.836Z\"\r\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{apiBaseUrl}}/api/v1/documenttypes",
      "host": [
        "{{apiBaseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "documenttypes"
      ]
    }
  },
  "response": [
  ]
}