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) effectconnect Read Orderlist

Get a set of orders filtered by the parameters in the XML payload.

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
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @sTmp1 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @success int

    DECLARE @fullUri nvarchar(4000)
    SELECT @fullUri = 'https://submit.effectconnect.com/orderlist'
    DECLARE @uri nvarchar(4000)
    SELECT @uri = '/orderlist'
    DECLARE @apiVersion nvarchar(4000)
    SELECT @apiVersion = '2.0'

    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

    -- Use your effectconnect public key here..
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'KEY', 'PUBLIC_KEY'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'VERSION', @apiVersion
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'URI', @uri
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'RESPONSETYPE', 'XML'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'RESPONSELANGUAGE', 'en'

    -- Get the current date/time in timestamp format.
    DECLARE @dt int
    -- Use "Chilkat_9_5_0.CkDateTime" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.CkDateTime', @dt OUT

    EXEC sp_OAMethod @dt, 'SetFromCurrentSystemTime', @success OUT
    DECLARE @timestamp nvarchar(4000)
    EXEC sp_OAMethod @dt, 'GetAsTimestamp', @timestamp OUT, 1

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'TIME', @timestamp

    PRINT 'timestamp = ' + @timestamp

    -- Create the following XML request body:
    -- <?xml version="1.0" encoding="utf-8"?>
    -- <list>
    --   <filters>
    --     <fromDateFilter>
    --       <filterValue>2018-09-14T12:12:12+01:00</filterValue>
    --     </fromDateFilter>
    --     <toDateFilter>
    --       <filterValue>2019-04-13T23:59:59+01:00</filterValue>
    --     </toDateFilter>
    --     <hasStatusFilter>
    --       <filterValue>paid</filterValue>
    --     </hasStatusFilter>
    --     <hasTagFilter>
    --       <filterValue>
    --         <tagName>Test</tagName>
    --         <exclude>false</exclude>
    --       </filterValue>
    --     </hasTagFilter>
    --   </filters>
    -- </list>

    -- Use this online tool to generate the code from sample XML: 
    -- Generate Code to Create XML

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

    EXEC sp_OASetProperty @xml, 'Tag', 'list'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'filters|fromDateFilter|filterValue', '2018-09-14T12:12:12+01:00'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'filters|toDateFilter|filterValue', '2019-04-13T23:59:59+01:00'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'filters|hasStatusFilter|filterValue', 'paid'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'filters|hasTagFilter|filterValue|tagName', 'Test'
    EXEC sp_OAMethod @xml, 'UpdateChildContent', NULL, 'filters|hasTagFilter|filterValue|exclude', 'false'
    EXEC sp_OASetProperty @xml, 'EmitCompact', 1

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

    EXEC sp_OAMethod @xml, 'GetXmlSb', @success OUT, @sbXml

    -- Build a string-to-sign and sign it using our effectconnect private key
    DECLARE @sbStringToSign int
    -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbStringToSign OUT

    EXEC sp_OAGetProperty @sbXml, 'Length', @iTmp0 OUT
    EXEC sp_OAMethod @sbStringToSign, 'AppendInt', @success OUT, @iTmp0
    EXEC sp_OAMethod @sbStringToSign, 'Append', @success OUT, 'POST'
    EXEC sp_OAMethod @sbStringToSign, 'Append', @success OUT, @uri
    EXEC sp_OAMethod @sbStringToSign, 'Append', @success OUT, @apiVersion
    EXEC sp_OAMethod @sbStringToSign, 'Append', @success OUT, @timestamp

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

    EXEC sp_OASetProperty @crypt, 'MacAlgorithm', 'hmac'
    EXEC sp_OASetProperty @crypt, 'HashAlgorithm', 'sha512'
    EXEC sp_OASetProperty @crypt, 'EncodingMode', 'base64'
    -- Use your effectconnect private key here:
    EXEC sp_OAMethod @crypt, 'SetMacKeyString', @success OUT, 'PRIVATE_KEY'
    EXEC sp_OAMethod @sbStringToSign, 'GetAsString', @sTmp1 OUT
    EXEC sp_OAMethod @crypt, 'MacStringENC', @sTmp0 OUT, @sTmp1
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'SIGNATURE', @sTmp0

    -- Send the POST..
    DECLARE @resp int
    EXEC sp_OAMethod @xml, 'GetXml', @sTmp0 OUT
    EXEC sp_OAMethod @http, 'PostXml', @resp OUT, @fullUri, @sTmp0, 'utf-8'
    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 @dt
        EXEC @hr = sp_OADestroy @xml
        EXEC @hr = sp_OADestroy @sbXml
        EXEC @hr = sp_OADestroy @sbStringToSign
        EXEC @hr = sp_OADestroy @crypt
        RETURN
      END


    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT 'response status code = ' + @iTmp0

    -- Examine the response.  The response status code can be 200 for both errors and success.
    -- The success or error is based on the XML returned in the response body.
    DECLARE @xmlResp int
    -- Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Xml', @xmlResp OUT

    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    EXEC sp_OAMethod @xmlResp, 'LoadXml', @success OUT, @sTmp0
    EXEC @hr = sp_OADestroy @resp


    PRINT 'response body:'
    EXEC sp_OAMethod @xmlResp, 'GetXml', @sTmp0 OUT
    PRINT @sTmp0

    -- Remove previously set headers (unless we want the same headers for the next request,
    -- in which case we may remove or update individual headers by calling SetRequestHeader.
    EXEC sp_OAMethod @http, 'ClearHeaders', NULL

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @dt
    EXEC @hr = sp_OADestroy @xml
    EXEC @hr = sp_OADestroy @sbXml
    EXEC @hr = sp_OADestroy @sbStringToSign
    EXEC @hr = sp_OADestroy @crypt
    EXEC @hr = sp_OADestroy @xmlResp


END
GO

 

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