Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

SQL Server Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(SQL Server) Aruba Fatturazione Elettronica Find Invoice by Username

Finds a list of invoices. Returns invoices without content in base64 (lazy loading)

For more information, see https://fatturazioneelettronica.aruba.it/apidoc/docs_EN.html#_findbyusername_2

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr 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

    -- Implements the following CURL command:

    -- curl -X GET https://ws.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Username \
    --   -H "Accept: application/json" \
    --   -H "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="

    -- Use the following online tool to generate HTTP code from a CURL command
    -- Convert a cURL Command to HTTP Source Code

    -- Adds the "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" header.
    EXEC sp_OASetProperty @http, 'AuthToken', 'NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE='
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'

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

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://ws.fatturazioneelettronica.aruba.it/services/invoice/in/findByUsername?username=Username', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

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

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "errorCode": "0000",
    --   "errorDescription": null,
    --   "content": [
    --     {
    --       "errorCode": null,
    --       "errorDescription": null,
    --       "id": "1",
    --       "sender": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "22222222",
    --         "fiscalCode": "11111111111"
    --       },
    --       "receiver": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "4444444",
    --         "fiscalCode": "333333333"
    --       },
    --       "invoiceType": "FPR12",
    --       "docType": "in",
    --       "file": null,
    --       "filename": "IT01879020517_jtlk0.xml.p7m",
    --       "invoices": [
    --         {
    --           "invoiceDate": "2020-07-10T09:19:56.948+02:00",
    --           "number": "2020/0001",
    --           "status": "Inviata",
    --           "statusDescription": ""
    --         }
    --       ],
    --       "username": "Utente",
    --       "lastUpdate": "2020-07-10T07:19:56.948+0000",
    --       "creationDate": "2020-07-10T07:19:56.948+0000",
    --       "idSdi": "11110",
    --       "pddAvailable": true
    --     },
    --     {
    --       "errorCode": null,
    --       "errorDescription": null,
    --       "id": "2",
    --       "sender": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "22222222",
    --         "fiscalCode": "11111111111"
    --       },
    --       "receiver": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "4444444",
    --         "fiscalCode": "333333333"
    --       },
    --       "invoiceType": "FPR12",
    --       "docType": "in",
    --       "file": null,
    --       "filename": "IT01879020517_jtlk1.xml.p7m",
    --       "invoices": [
    --         {
    --           "invoiceDate": "2020-07-10T09:19:56.948+02:00",
    --           "number": "2020/0002",
    --           "status": "Inviata",
    --           "statusDescription": ""
    --         }
    --       ],
    --       "username": "Utente",
    --       "lastUpdate": "2020-07-10T07:19:56.948+0000",
    --       "creationDate": "2020-07-10T07:19:56.948+0000",
    --       "idSdi": "11111",
    --       "pddAvailable": true
    --     },
    --     {
    --       "errorCode": null,
    --       "errorDescription": null,
    --       "id": "3",
    --       "sender": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "22222222",
    --         "fiscalCode": "11111111111"
    --       },
    --       "receiver": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "4444444",
    --         "fiscalCode": "333333333"
    --       },
    --       "invoiceType": "FPR12",
    --       "docType": "in",
    --       "file": null,
    --       "filename": "IT01879020517_jtlk2.xml.p7m",
    --       "invoices": [
    --         {
    --           "invoiceDate": "2020-07-10T09:19:56.948+02:00",
    --           "number": "2020/0003",
    --           "status": "Inviata",
    --           "statusDescription": ""
    --         }
    --       ],
    --       "username": "Utente",
    --       "lastUpdate": "2020-07-10T07:19:56.948+0000",
    --       "creationDate": "2020-07-10T07:19:56.948+0000",
    --       "idSdi": "11112",
    --       "pddAvailable": true
    --     },
    --     {
    --       "errorCode": null,
    --       "errorDescription": null,
    --       "id": "4",
    --       "sender": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "22222222",
    --         "fiscalCode": "11111111111"
    --       },
    --       "receiver": {
    --         "description": "Aruba SPA",
    --         "countryCode": "IT",
    --         "vatCode": "4444444",
    --         "fiscalCode": "333333333"
    --       },
    --       "invoiceType": "FPR12",
    --       "docType": "in",
    --       "file": null,
    --       "filename": "IT01879020517_jtlk3.xml.p7m",
    --       "invoices": [
    --         {
    --           "invoiceDate": "2020-07-10T09:19:56.948+02:00",
    --           "number": "2020/0004",
    --           "status": "Inviata",
    --           "statusDescription": ""
    --         }
    --       ],
    --       "username": "Utente",
    --       "lastUpdate": "2020-07-10T07:19:56.948+0000",
    --       "creationDate": "2020-07-10T07:19:56.948+0000",
    --       "idSdi": "11113",
    --       "pddAvailable": true
    --     }
    --   ],
    --   "last": true,
    --   "totalElements": 4,
    --   "totalPages": 1,
    --   "size": 10,
    --   "number": 1,
    --   "first": true,
    --   "numberOfElements": 4
    -- }

    -- Sample code for parsing the JSON response...
    -- Use the following online tool to generate parsing code from sample JSON:
    -- Generate Parsing Code from JSON

    DECLARE @id nvarchar(4000)

    DECLARE @senderDescription nvarchar(4000)

    DECLARE @senderCountryCode nvarchar(4000)

    DECLARE @senderVatCode nvarchar(4000)

    DECLARE @senderFiscalCode nvarchar(4000)

    DECLARE @receiverDescription nvarchar(4000)

    DECLARE @receiverCountryCode nvarchar(4000)

    DECLARE @receiverVatCode nvarchar(4000)

    DECLARE @receiverFiscalCode nvarchar(4000)

    DECLARE @invoiceType nvarchar(4000)

    DECLARE @docType nvarchar(4000)

    DECLARE @file nvarchar(4000)

    DECLARE @filename nvarchar(4000)

    DECLARE @username nvarchar(4000)

    DECLARE @lastUpdate nvarchar(4000)

    DECLARE @creationDate nvarchar(4000)

    DECLARE @idSdi nvarchar(4000)

    DECLARE @pddAvailable int

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @invoiceDate nvarchar(4000)

    DECLARE @number_str nvarchar(4000)

    DECLARE @status nvarchar(4000)

    DECLARE @statusDescription nvarchar(4000)

    DECLARE @errorCode nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @errorCode OUT, 'errorCode'
    DECLARE @errorDescription nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @errorDescription OUT, 'errorDescription'
    DECLARE @last int
    EXEC sp_OAMethod @jResp, 'BoolOf', @last OUT, 'last'
    DECLARE @totalElements int
    EXEC sp_OAMethod @jResp, 'IntOf', @totalElements OUT, 'totalElements'
    DECLARE @totalPages int
    EXEC sp_OAMethod @jResp, 'IntOf', @totalPages OUT, 'totalPages'
    DECLARE @size int
    EXEC sp_OAMethod @jResp, 'IntOf', @size OUT, 'size'
    DECLARE @number int
    EXEC sp_OAMethod @jResp, 'IntOf', @number OUT, 'number'
    DECLARE @first int
    EXEC sp_OAMethod @jResp, 'BoolOf', @first OUT, 'first'
    DECLARE @numberOfElements int
    EXEC sp_OAMethod @jResp, 'IntOf', @numberOfElements OUT, 'numberOfElements'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'content'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @errorCode OUT, 'content[i].errorCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @errorDescription OUT, 'content[i].errorDescription'
        EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'content[i].id'
        EXEC sp_OAMethod @jResp, 'StringOf', @senderDescription OUT, 'content[i].sender.description'
        EXEC sp_OAMethod @jResp, 'StringOf', @senderCountryCode OUT, 'content[i].sender.countryCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @senderVatCode OUT, 'content[i].sender.vatCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @senderFiscalCode OUT, 'content[i].sender.fiscalCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @receiverDescription OUT, 'content[i].receiver.description'
        EXEC sp_OAMethod @jResp, 'StringOf', @receiverCountryCode OUT, 'content[i].receiver.countryCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @receiverVatCode OUT, 'content[i].receiver.vatCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @receiverFiscalCode OUT, 'content[i].receiver.fiscalCode'
        EXEC sp_OAMethod @jResp, 'StringOf', @invoiceType OUT, 'content[i].invoiceType'
        EXEC sp_OAMethod @jResp, 'StringOf', @docType OUT, 'content[i].docType'
        EXEC sp_OAMethod @jResp, 'StringOf', @file OUT, 'content[i].file'
        EXEC sp_OAMethod @jResp, 'StringOf', @filename OUT, 'content[i].filename'
        EXEC sp_OAMethod @jResp, 'StringOf', @username OUT, 'content[i].username'
        EXEC sp_OAMethod @jResp, 'StringOf', @lastUpdate OUT, 'content[i].lastUpdate'
        EXEC sp_OAMethod @jResp, 'StringOf', @creationDate OUT, 'content[i].creationDate'
        EXEC sp_OAMethod @jResp, 'StringOf', @idSdi OUT, 'content[i].idSdi'
        EXEC sp_OAMethod @jResp, 'BoolOf', @pddAvailable OUT, 'content[i].pddAvailable'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'content[i].invoices'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @invoiceDate OUT, 'content[i].invoices[j].invoiceDate'
            EXEC sp_OAMethod @jResp, 'StringOf', @number_str OUT, 'content[i].invoices[j].number'
            EXEC sp_OAMethod @jResp, 'StringOf', @status OUT, 'content[i].invoices[j].status'
            EXEC sp_OAMethod @jResp, 'StringOf', @statusDescription OUT, 'content[i].invoices[j].statusDescription'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.