Back to Collection Items
        #include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW json;
    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.
    // {
    //   "type": "Summary",
    //   "format": "JSON",
    //   "queryParameters": {
    //     "dateFrom": "2020-10-01T21:00:28.451Z",
    //     "dateTo": "2020-12-30T21:00:28.451Z",
    //     "statuses": [
    //       "Valid",
    //       "Cancelled",
    //       "Rejected"
    //     ],
    //     "productsInternalCodes": [
    //     ],
    //     "receiverSenderId": "",
    //     "receiverSenderType": "0",
    //     "branchNumber": "",
    //     "itemCodes": [
    //       {
    //         "codeValue": "",
    //         "codeType": ""
    //       }
    //     ],
    //     "documentTypeNames": [
    //     ]
    //   }
    // }
    json = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(json,L"type",L"Summary");
    CkJsonObjectW_UpdateString(json,L"format",L"JSON");
    CkJsonObjectW_UpdateString(json,L"queryParameters.dateFrom",L"2020-10-01T21:00:28.451Z");
    CkJsonObjectW_UpdateString(json,L"queryParameters.dateTo",L"2020-12-30T21:00:28.451Z");
    CkJsonObjectW_UpdateString(json,L"queryParameters.statuses[0]",L"Valid");
    CkJsonObjectW_UpdateString(json,L"queryParameters.statuses[1]",L"Cancelled");
    CkJsonObjectW_UpdateString(json,L"queryParameters.statuses[2]",L"Rejected");
    CkJsonObjectW_UpdateNewArray(json,L"queryParameters.productsInternalCodes");
    CkJsonObjectW_UpdateString(json,L"queryParameters.receiverSenderId",L"");
    CkJsonObjectW_UpdateString(json,L"queryParameters.receiverSenderType",L"0");
    CkJsonObjectW_UpdateString(json,L"queryParameters.branchNumber",L"");
    CkJsonObjectW_UpdateString(json,L"queryParameters.itemCodes[0].codeValue",L"");
    CkJsonObjectW_UpdateString(json,L"queryParameters.itemCodes[0].codeType",L"");
    CkJsonObjectW_UpdateNewArray(json,L"queryParameters.documentTypeNames");
    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttpW_putAuthToken(http,L"<access_token>");
    resp = CkHttpResponseW_Create();
    success = CkHttpW_HttpJson(http,L"POST",L"https://domain.com/api/v1/documentPackages/requests",json,L"application/json",resp);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(json);
        CkHttpResponseW_Dispose(resp);
        return;
    }
    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(json);
    CkHttpResponseW_Dispose(resp);
    }
        Curl Command
        curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
    "type": "Summary",
    "format": "JSON",
    "queryParameters": {
        "dateFrom": "2020-10-01T21:00:28.451Z",
        "dateTo": "2020-12-30T21:00:28.451Z",
        "statuses": [
            "Valid",
            "Cancelled",
            "Rejected"
        ],
        "productsInternalCodes": [],
        "receiverSenderId": "",
        "receiverSenderType": "0",
        "branchNumber": "",
        "itemCodes": [
            {
                "codeValue": "",
                "codeType": ""
            }
        ],
        "documentTypeNames": []
    }
}'
https://domain.com/api/v1/documentPackages/requests
        Postman Collection Item JSON
        {
  "name": "5. Request Document Package",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{generatedAccessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\r\n    \"type\": \"Summary\",\r\n    \"format\": \"JSON\",\r\n    \"queryParameters\": {\r\n        \"dateFrom\": \"2020-10-01T21:00:28.451Z\",\r\n        \"dateTo\": \"2020-12-30T21:00:28.451Z\",\r\n        \"statuses\": [\r\n            \"Valid\",\r\n            \"Cancelled\",\r\n            \"Rejected\"\r\n        ],\r\n        \"productsInternalCodes\": [],\r\n        \"receiverSenderId\": \"\",\r\n        \"receiverSenderType\": \"0\",\r\n        \"branchNumber\": \"\",\r\n        \"itemCodes\": [\r\n            {\r\n                \"codeValue\": \"\",\r\n                \"codeType\": \"\"\r\n            }\r\n        ],\r\n        \"documentTypeNames\": []\r\n    }\r\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{apiBaseUrl}}/api/v1/documentPackages/requests",
      "host": [
        "{{apiBaseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "documentPackages",
        "requests"
      ]
    }
  },
  "response": [
  ]
}