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

PowerBuilder 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

 

 

 

(PowerBuilder) Shopify Private Authentication for Private Apps

Shopify private authentication is for interacting with your own store through private applications. It uses HTTP "Basic" authentication with your Shopify private application key and secret key.

This example demonstrates how to send a private authenticated request using Chilkat Http, and then the same using Chilkat Rest.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
oleobject loo_Resp
oleobject loo_SbJson
oleobject loo_Json
oleobject loo_Rest
integer li_BTls
integer li_Port
integer li_BAutoReconnect
integer li_Success

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

// First demonstrate sending a simple request using Shopify private authentication w/ the Chilkat Http API.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// To use HTTP Basic Authentication with any HTTP request, we simply set the Login, Password, and BasicAuth properties.
// Important: All HTTP requests using Basic authentication must be over SSL/TLS.
loo_Http.Login = "SHOPIFY_PRIVATE_API_KEY"
loo_Http.Password = "SHOPIFY_PRIVATE_API_SECRET_KEY"
loo_Http.BasicAuth = 1

// Make sure to replace "chilkat" with your store name.
loo_Resp = loo_Http.QuickGetObj("https://chilkat.myshopify.com/admin/products.json")
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

// Examine the response code.
if loo_Resp.StatusCode <> 200 then
    Write-Debug "Received error response code: " + string(loo_Resp.StatusCode)
    Write-Debug "Response body:"
    Write-Debug loo_Resp.BodyStr
    destroy loo_Resp
    destroy loo_Http
    return
end if

// Success.
Write-Debug "Success."

// Examine the JSON response 
loo_SbJson = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbJson.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbJson)
destroy loo_Resp
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.LoadSb(loo_SbJson)
loo_Json.EmitCompact = 0
Write-Debug loo_Json.Emit()

// -------------------------------------------------
// Now let's do the same using the Chilkat Rest API.
loo_Rest = create oleobject
// Use "Chilkat_9_5_0.Rest" for versions of Chilkat < 10.0.0
li_rc = loo_Rest.ConnectToNewObject("Chilkat.Rest")

// Provide the private app credentials:
loo_Rest.SetAuthBasic("SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_SECRET_KEY")

// Connect to the shopify server.
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
// Make sure to replace "chilkat" with your store name.
li_Success = loo_Rest.Connect("chilkat.myshopify.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Http
    destroy loo_SbJson
    destroy loo_Json
    destroy loo_Rest
    return
end if

loo_SbJson.Clear()
li_Success = loo_Rest.FullRequestNoBodySb("GET","/admin/products.json",loo_SbJson)
if loo_Rest.LastMethodSuccess <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Http
    destroy loo_SbJson
    destroy loo_Json
    destroy loo_Rest
    return
end if

if loo_Rest.ResponseStatusCode <> 200 then
    Write-Debug "Received error response code: " + string(loo_Rest.ResponseStatusCode)
    Write-Debug "Response body:"
    Write-Debug loo_SbJson.GetAsString()
    destroy loo_Http
    destroy loo_SbJson
    destroy loo_Json
    destroy loo_Rest
    return
end if

// Success...
loo_Json.LoadSb(loo_SbJson)
Write-Debug loo_Json.Emit()


destroy loo_Http
destroy loo_SbJson
destroy loo_Json
destroy loo_Rest

 

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