Chilkat Online Tools

SQL Server / Egyptian eInvoicing SDK R1.5 / 8. Get Recent Receipts

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    DECLARE @queryParams int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT

    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'Uuid', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'SubmissionUuid', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'ReceiptNumber', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'DocumentTypeCode', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'DocumentTypeVersion', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'ReceiverName', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'ReceiverRegisterationNumber', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'PosSerialNumber', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'PaymentMethod', 'ut dolore'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'SubmissionChannel', 'POS'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'Status', 'Valid'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'Direction', 'Submitted'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'SortBy', 'None'
    EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'SortDir', 'None'
    EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'PageNo', 63021623
    EXEC sp_OAMethod @queryParams, 'UpdateInt', @success OUT, 'PageSize', 63021623

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://domain.com/api/v1/receipts/recent', @queryParams
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @queryParams
        RETURN
      END

    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT @iTmp0
    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    PRINT @sTmp0
    EXEC @hr = sp_OADestroy @resp


    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @queryParams


END
GO

Curl Command

curl -G -d "Uuid=ut%20dolore"
	-d "SubmissionUuid=ut%20dolore"
	-d "ReceiptNumber=ut%20dolore"
	-d "DocumentTypeCode=ut%20dolore"
	-d "DocumentTypeVersion=ut%20dolore"
	-d "ReceiverName=ut%20dolore"
	-d "ReceiverRegisterationNumber=ut%20dolore"
	-d "PosSerialNumber=ut%20dolore"
	-d "PaymentMethod=ut%20dolore"
	-d "SubmissionChannel=POS"
	-d "Status=Valid"
	-d "Direction=Submitted"
	-d "SortBy=None"
	-d "SortDir=None"
	-d "PageNo=63021623"
	-d "PageSize=63021623"
	-H "Authorization: Bearer <access_token>"
https://domain.com/api/v1/receipts/recent

Postman Collection Item JSON

{
  "name": "8. Get Recent Receipts",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{generatedAccessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{apiBaseUrl}}/api/v1/receipts/recent?Uuid=ut dolore&SubmissionUuid=ut dolore&ReceiptNumber=ut dolore&DocumentTypeCode=ut dolore&DocumentTypeVersion=ut dolore&ReceiverName=ut dolore&ReceiverRegisterationNumber=ut dolore&PosSerialNumber=ut dolore&PaymentMethod=ut dolore&SubmissionChannel=POS&Status=Valid&Direction=Submitted&SortBy=None&SortDir=None&PageNo=63021623&PageSize=63021623",
      "host": [
        "{{apiBaseUrl}}"
      ],
      "path": [
        "api",
        "v1",
        "receipts",
        "recent"
      ],
      "query": [
        {
          "key": "Uuid",
          "value": "ut dolore"
        },
        {
          "key": "SubmissionUuid",
          "value": "ut dolore"
        },
        {
          "key": "ReceiptNumber",
          "value": "ut dolore"
        },
        {
          "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": "PaymentMethod",
          "value": "ut dolore"
        },
        {
          "key": "SubmissionChannel",
          "value": "POS"
        },
        {
          "key": "Status",
          "value": "Valid"
        },
        {
          "key": "Direction",
          "value": "Submitted"
        },
        {
          "key": "SortBy",
          "value": "None"
        },
        {
          "key": "SortDir",
          "value": "None"
        },
        {
          "key": "PageNo",
          "value": "63021623"
        },
        {
          "key": "PageSize",
          "value": "63021623"
        }
      ]
    }
  },
  "response": [
  ]
}