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
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) Constant Contact: Create a Contact

Creates a single contact.

For more information, see https://v3.developer.constantcontact.com/api_guide/contacts_create.html#cURL2

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Contact_id
string ls_Email_addressAddress
string ls_Email_addressPermission_to_send
string ls_Email_addressCreated_at
string ls_Email_addressUpdated_at
string ls_Email_addressOpt_in_source
string ls_Email_addressOpt_in_date
string ls_Email_addressConfirm_status
string ls_First_name
string ls_Last_name
string ls_Job_title
string ls_Company_name
integer li_Birthday_month
integer li_Birthday_day
string ls_Anniversary
string ls_Create_source
string ls_Created_at
string ls_Updated_at

// 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 -X POST \
//   https://api.cc.email/v3/contacts \
//   -H 'accept: application/json' \
//   -H 'authorization: Bearer {access_token}' \
//   -H 'cache-control: no-cache' \
//   -H 'content-type: application/json' \
//   -d '{
//   "email_address": {
//     "address": "danipper@example.com",
//     "permission_to_send": "implicit"
//   },
//   "first_name": "David",
//   "last_name": "Nipper",
//   "job_title": "Musician",
//   "company_name": "Acme Corp.",
//   "create_source": "Account",
//   "birthday_month": 11,
//   "birthday_day": 24,
//   "anniversary": "2006-11-15",
//   "steet_addresses":{
//     "kind":"home",
//     "street": "123 Kashmir Valley Road",
//     "city": "Chicago",
//     "state": "Illinois",
//     "country": "United States",
//   }
// }'

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

// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "email_address": {
//     "address": "danipper@example.com",
//     "permission_to_send": "implicit"
//   },
//   "first_name": "David",
//   "last_name": "Nipper",
//   "job_title": "Musician",
//   "company_name": "Acme Corp.",
//   "create_source": "Account",
//   "birthday_month": 11,
//   "birthday_day": 24,
//   "anniversary": "2006-11-15",
//   "steet_addresses": {
//     "kind": "home",
//     "street": "123 Kashmir Valley Road",
//     "city": "Chicago",
//     "state": "Illinois",
//     "country": "United States"
//   }
// }

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.UpdateString("email_address.address","danipper@example.com")
loo_Json.UpdateString("email_address.permission_to_send","implicit")
loo_Json.UpdateString("first_name","David")
loo_Json.UpdateString("last_name","Nipper")
loo_Json.UpdateString("job_title","Musician")
loo_Json.UpdateString("company_name","Acme Corp.")
loo_Json.UpdateString("create_source","Account")
loo_Json.UpdateInt("birthday_month",11)
loo_Json.UpdateInt("birthday_day",24)
loo_Json.UpdateString("anniversary","2006-11-15")
loo_Json.UpdateString("steet_addresses.kind","home")
loo_Json.UpdateString("steet_addresses.street","123 Kashmir Valley Road")
loo_Json.UpdateString("steet_addresses.city","Chicago")
loo_Json.UpdateString("steet_addresses.state","Illinois")
loo_Json.UpdateString("steet_addresses.country","United States")

loo_Http.SetRequestHeader("content-type","application/json")
// Adds the "Authorization: Bearer ACCESS_TOKEN" header.
loo_Http.AuthToken = "ACCESS_TOKEN"
loo_Http.SetRequestHeader("cache-control","no-cache")
loo_Http.SetRequestHeader("accept","application/json")

loo_Resp = loo_Http.PostJson3("https://api.cc.email/v3/contacts","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    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_Json
    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)

// {
//   "contact_id": "{contact_id}",
//   "email_address": {
//     "address": "danipper@example.com",
//     "permission_to_send": "implicit",
//     "created_at": "2018-02-23T13:38:28-05:00",
//     "updated_at": "2018-02-23T13:38:28-05:00",
//     "opt_in_source": "Account",
//     "opt_in_date": "2018-02-23T13:38:28-05:00",
//     "confirm_status": "off"
//   },
//   "first_name": "David",
//   "last_name": "Nipper",
//   "job_title": "Musician",
//   "company_name": "Acme Corp.",
//   "birthday_month": 11,
//   "birthday_day": 24,
//   "anniversary": "2006-11-15",
//   "create_source": "Account",
//   "created_at": "2018-02-23T13:38:28-05:00",
//   "updated_at": "2018-02-23T13:38:28-05:00"
// }

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

ls_Contact_id = loo_JResp.StringOf("contact_id")
ls_Email_addressAddress = loo_JResp.StringOf("email_address.address")
ls_Email_addressPermission_to_send = loo_JResp.StringOf("email_address.permission_to_send")
ls_Email_addressCreated_at = loo_JResp.StringOf("email_address.created_at")
ls_Email_addressUpdated_at = loo_JResp.StringOf("email_address.updated_at")
ls_Email_addressOpt_in_source = loo_JResp.StringOf("email_address.opt_in_source")
ls_Email_addressOpt_in_date = loo_JResp.StringOf("email_address.opt_in_date")
ls_Email_addressConfirm_status = loo_JResp.StringOf("email_address.confirm_status")
ls_First_name = loo_JResp.StringOf("first_name")
ls_Last_name = loo_JResp.StringOf("last_name")
ls_Job_title = loo_JResp.StringOf("job_title")
ls_Company_name = loo_JResp.StringOf("company_name")
li_Birthday_month = loo_JResp.IntOf("birthday_month")
li_Birthday_day = loo_JResp.IntOf("birthday_day")
ls_Anniversary = loo_JResp.StringOf("anniversary")
ls_Create_source = loo_JResp.StringOf("create_source")
ls_Created_at = loo_JResp.StringOf("created_at")
ls_Updated_at = loo_JResp.StringOf("updated_at")


destroy loo_Http
destroy loo_Json
destroy loo_SbResponseBody
destroy loo_JResp

 

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