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
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
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
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
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) Shopify Get particular fields of a single product

Get particular fields of a single product

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
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @rest int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OAMethod @rest, 'SetAuthBasic', @success OUT, 'SHOPIFY_PRIVATE_API_KEY', 'SHOPIFY_PRIVATE_API_KEY'

    EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'chilkat.myshopify.com', 443, 1, 1
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        RETURN
      END

    DECLARE @sbJson int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbJson OUT

    EXEC sp_OAMethod @rest, 'FullRequestNoBodySb', @success OUT, 'GET', '/admin/products/#{id}.json?fields=id,images,title', @sbJson
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @sbJson
        RETURN
      END

    EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
    IF @iTmp0 <> 200
      BEGIN

        EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
        PRINT 'Received error response code: ' + @iTmp0

        PRINT 'Response body:'
        EXEC sp_OAMethod @sbJson, 'GetAsString', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @rest
        EXEC @hr = sp_OADestroy @sbJson
        RETURN
      END

    DECLARE @json int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'LoadSb', @success OUT, @sbJson

    -- The following code parses the JSON response.
    -- A sample JSON response is shown below the sample code.
    DECLARE @productId int

    DECLARE @productTitle nvarchar(4000)

    DECLARE @i int

    DECLARE @count_i int

    DECLARE @id int

    DECLARE @product_id int

    DECLARE @position int

    DECLARE @created_at nvarchar(4000)

    DECLARE @updated_at nvarchar(4000)

    DECLARE @width int

    DECLARE @height int

    DECLARE @src nvarchar(4000)

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @intVal int

    EXEC sp_OAMethod @json, 'IntOf', @productId OUT, 'product.id'
    EXEC sp_OAMethod @json, 'StringOf', @productTitle OUT, 'product.title'
    SELECT @i = 0
    EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'product.images'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @json, 'I', @i
        EXEC sp_OAMethod @json, 'IntOf', @id OUT, 'product.images[i].id'
        EXEC sp_OAMethod @json, 'IntOf', @product_id OUT, 'product.images[i].product_id'
        EXEC sp_OAMethod @json, 'IntOf', @position OUT, 'product.images[i].position'
        EXEC sp_OAMethod @json, 'StringOf', @created_at OUT, 'product.images[i].created_at'
        EXEC sp_OAMethod @json, 'StringOf', @updated_at OUT, 'product.images[i].updated_at'
        EXEC sp_OAMethod @json, 'IntOf', @width OUT, 'product.images[i].width'
        EXEC sp_OAMethod @json, 'IntOf', @height OUT, 'product.images[i].height'
        EXEC sp_OAMethod @json, 'StringOf', @src OUT, 'product.images[i].src'
        SELECT @j = 0
        EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'product.images[i].variant_ids'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @json, 'J', @j
            EXEC sp_OAMethod @json, 'IntOf', @intVal OUT, 'product.images[i].variant_ids[j]'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    -- A sample JSON response body that is parsed by the above code:

    -- {
    --   "product": {
    --     "id": 632910392,
    --     "title": "IPod Nano - 8GB",
    --     "images": [
    --       {
    --         "id": 850703190,
    --         "product_id": 632910392,
    --         "position": 1,
    --         "created_at": "2017-09-22T14:08:02-04:00",
    --         "updated_at": "2017-09-22T14:08:02-04:00",
    --         "width": 123,
    --         "height": 456,
    --         "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano.png?v=1506103682",
    --         "variant_ids": [
    --         ]
    --       },
    --       {
    --         "id": 562641783,
    --         "product_id": 632910392,
    --         "position": 2,
    --         "created_at": "2017-09-22T14:08:02-04:00",
    --         "updated_at": "2017-09-22T14:08:02-04:00",
    --         "width": 123,
    --         "height": 456,
    --         "src": "https:\/\/cdn.shopify.com\/s\/files\/1\/0006\/9093\/3842\/products\/ipod-nano-2.png?v=1506103682",
    --         "variant_ids": [
    --           808950810
    --         ]
    --       }
    --     ]
    --   }
    -- }


    PRINT 'Example Completed.'

    EXEC @hr = sp_OADestroy @rest
    EXEC @hr = sp_OADestroy @sbJson
    EXEC @hr = sp_OADestroy @json


END
GO

 

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