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
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

 

 

 

(PowerBuilder) UniPin Game List

See more UniPin Examples

Demonstrates how to send a POST with the hash_hmac(sha256,partnerid+timestamp+path,secretkey) authentication.

For more information, see https://documenter.getpostman.com/view/8087848/SVfNvUt2?version=latest#1685124e-d292-4414-b1ca-e34e3f3ec7b4

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Dt
string ls_Timestamp
string ls_PartnerId
oleobject loo_Crypt
oleobject loo_SbMacData
string ls_Auth
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Game_category
string ls_Game_code
string ls_Game_name
string ls_Icon_url
string ls_Game_status
string ls_Updated_at
integer li_Status
string ls_Reason
integer i
integer li_Count_i

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Implements the following CURL command:

// curl --request POST 'https://dev-api.unipin.com/in-game-topup/list' \
// --header 'partnerid: 587e3675-e0ed-4e9e-9b39-099b11498fdc' \
// --header 'timestamp: 1566552295' \
// --header 'path: in-game-topup/list' \
// --header 'auth: 1d9f5e7aca9f3c14da7c957d6977447739877cebfc10fcf3682bd32da47a2bda' \
// --header 'Content-Type: application/json'

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

loo_Dt = create oleobject
li_rc = loo_Dt.ConnectToNewObject("Chilkat_9_5_0.CkDateTime")

loo_Dt.SetFromCurrentSystemTime()
ls_Timestamp = loo_Dt.GetAsUnixTimeStr(0)

// Change this to your actual partner ID.
ls_PartnerId = "587e3675-e0ed-4e9e-9b39-099b11498fdc"

loo_Http.SetRequestHeader("path","in-game-topup/list")
loo_Http.SetRequestHeader("timestamp",ls_Timestamp)
loo_Http.SetRequestHeader("partnerid",ls_PartnerId)
loo_Http.SetRequestHeader("Content-Type","application/json")

// Calculate the auth header using  hash_hmac(sha256,partnerid+timestamp+path,secretkey)
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat_9_5_0.Crypt2")

loo_Crypt.MacAlgorithm = "hmac"
loo_Crypt.HashAlgorithm = "sha256"
loo_Crypt.EncodingMode = "hexlower"

// Change this to your actual secret key..
loo_Crypt.SetMacKeyEncoded("wabc123asljdgadlgd3","us-ascii")

loo_SbMacData = create oleobject
li_rc = loo_SbMacData.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_SbMacData.Append(ls_PartnerId)
loo_SbMacData.Append(ls_Timestamp)
loo_SbMacData.Append("in-game-topup/list")

ls_Auth = loo_Crypt.MacStringENC(loo_SbMacData.GetAsString())
loo_Http.SetRequestHeader("auth",ls_Auth)

loo_Resp = loo_Http.QuickRequest("POST","https://dev-api.unipin.com/in-game-topup/list")
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Dt
    destroy loo_Crypt
    destroy loo_SbMacData
    return
end if

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_Dt
    destroy loo_Crypt
    destroy loo_SbMacData
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

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

// {
//   "game_list": [
//     {
//       "game_category": "MLBB_ID",
//       "game_code": "MLBBD_ID",
//       "game_name": "Mobile Legends Diamonds",
//       "icon_url": "http://dev-backoffice.unipin.com/images/icon_direct_topup_games/1565343343-icon-1548659712-icon-Mobile legend 300x300 px.png",
//       "game_status": "active",
//       "updated_at": "2019-08-09 16:35:43"
//     },
//     {
//       "game_category": "MLBB_ID",
//       "game_code": "MLBBS_ID",
//       "game_name": "Mobile Legends Starlight Member",
//       "icon_url": "http://dev-backoffice.unipin.com/images/icon_direct_topup_games/1565343258-icon-1548659712-icon-Mobile legend 300x300 px.png",
//       "game_status": "active",
//       "updated_at": "2019-08-09 16:34:18"
//     },
// ...
// ...
//   ],
//   "status": 1,
//   "reason": "Successful"
// }

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

li_Status = loo_JResp.IntOf("status")
ls_Reason = loo_JResp.StringOf("reason")
i = 0
li_Count_i = loo_JResp.SizeOfArray("game_list")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Game_category = loo_JResp.StringOf("game_list[i].game_category")
    ls_Game_code = loo_JResp.StringOf("game_list[i].game_code")
    ls_Game_name = loo_JResp.StringOf("game_list[i].game_name")
    ls_Icon_url = loo_JResp.StringOf("game_list[i].icon_url")
    ls_Game_status = loo_JResp.StringOf("game_list[i].game_status")
    ls_Updated_at = loo_JResp.StringOf("game_list[i].updated_at")
    i = i + 1
loop


destroy loo_Http
destroy loo_Dt
destroy loo_Crypt
destroy loo_SbMacData
destroy loo_SbResponseBody
destroy loo_JResp

 

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