Chilkat Online Tools

unicodeC / Egyptian eInvoicing SDK R1.5 / 7. Search Receipts

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW queryParams;
    HCkHttpResponseW resp;

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

    http = CkHttpW_Create();

    queryParams = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(queryParams,L"FreeText",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"Direction",L"Submitted");
    CkJsonObjectW_UpdateString(queryParams,L"DateTimeIssuedFrom",L"1997-06-27T10:04:59.938Z");
    CkJsonObjectW_UpdateString(queryParams,L"DateTimeIssuedTo",L"1997-06-27T10:04:59.938Z");
    CkJsonObjectW_UpdateString(queryParams,L"DateTimeReceivedFrom",L"1997-06-27T10:04:59.938Z");
    CkJsonObjectW_UpdateString(queryParams,L"DateTimeReceivedTo",L"1997-06-27T10:04:59.938Z");
    CkJsonObjectW_UpdateString(queryParams,L"DocumentTypeCode",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"DocumentTypeVersion",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"ReceiverName",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"ReceiverRegisterationNumber",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"PosSerialNumber",L"ut dolore");
    CkJsonObjectW_UpdateString(queryParams,L"SubmissionChannel",L"POS");
    CkJsonObjectW_UpdateString(queryParams,L"SortBy",L"None");
    CkJsonObjectW_UpdateString(queryParams,L"SortDir",L"None");
    CkJsonObjectW_UpdateInt(queryParams,L"PageNo",63021623);
    CkJsonObjectW_UpdateInt(queryParams,L"PageSize",63021623);

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

    resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://domain.com/api/v1/receipts/search",queryParams);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(queryParams);

    }

Curl Command

curl -G -d "FreeText=ut%20dolore"
	-d "Direction=Submitted"
	-d "DateTimeIssuedFrom=1997-06-27T10%3A04%3A59.938Z"
	-d "DateTimeIssuedTo=1997-06-27T10%3A04%3A59.938Z"
	-d "DateTimeReceivedFrom=1997-06-27T10%3A04%3A59.938Z"
	-d "DateTimeReceivedTo=1997-06-27T10%3A04%3A59.938Z"
	-d "DocumentTypeCode=ut%20dolore"
	-d "DocumentTypeVersion=ut%20dolore"
	-d "ReceiverName=ut%20dolore"
	-d "ReceiverRegisterationNumber=ut%20dolore"
	-d "PosSerialNumber=ut%20dolore"
	-d "SubmissionChannel=POS"
	-d "SortBy=None"
	-d "SortDir=None"
	-d "PageNo=63021623"
	-d "PageSize=63021623"
	-H "Authorization: Bearer <access_token>"
https://domain.com/api/v1/receipts/search

Postman Collection Item JSON

{
  "name": "7. Search Receipts",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{generatedAccessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{apiBaseUrl}}/api/v1/receipts/search?FreeText=ut dolore&Direction=Submitted&DateTimeIssuedFrom=1997-06-27T10:04:59.938Z&DateTimeIssuedTo=1997-06-27T10:04:59.938Z&DateTimeReceivedFrom=1997-06-27T10:04:59.938Z&DateTimeReceivedTo=1997-06-27T10:04:59.938Z&DocumentTypeCode=ut dolore&DocumentTypeVersion=ut dolore&ReceiverName=ut dolore&ReceiverRegisterationNumber=ut dolore&PosSerialNumber=ut dolore&SubmissionChannel=POS&SortBy=None&SortDir=None&PageNo=63021623&PageSize=63021623",
      "host": [
        "{{apiBaseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "receipts",
        "search"
      ],
      "query": [
        {
          "key": "FreeText",
          "value": "ut dolore"
        },
        {
          "key": "Direction",
          "value": "Submitted"
        },
        {
          "key": "DateTimeIssuedFrom",
          "value": "1997-06-27T10:04:59.938Z"
        },
        {
          "key": "DateTimeIssuedTo",
          "value": "1997-06-27T10:04:59.938Z"
        },
        {
          "key": "DateTimeReceivedFrom",
          "value": "1997-06-27T10:04:59.938Z"
        },
        {
          "key": "DateTimeReceivedTo",
          "value": "1997-06-27T10:04:59.938Z"
        },
        {
          "key": "DocumentTypeCode",
          "value": "ut dolore"
        },
        {
          "key": "DocumentTypeVersion",
          "value": "ut dolore"
        },
        {
          "key": "ReceiverName",
          "value": "ut dolore"
        },
        {
          "key": "ReceiverRegisterationNumber",
          "value": "ut dolore"
        },
        {
          "key": "PosSerialNumber",
          "value": "ut dolore"
        },
        {
          "key": "SubmissionChannel",
          "value": "POS"
        },
        {
          "key": "SortBy",
          "value": "None"
        },
        {
          "key": "SortDir",
          "value": "None"
        },
        {
          "key": "PageNo",
          "value": "63021623"
        },
        {
          "key": "PageSize",
          "value": "63021623"
        }
      ]
    }
  },
  "response": [
  ]
}