Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

MedTunnel
MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
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
UniPin
VoiceBase
Vonage
Walmart
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yousign
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Constant Contact - Get Contact by Email Address

Get the contact details for a given email address.

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

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sContact_id
    String sEmail_addressAddress
    String sEmail_addressPermission_to_send
    String sEmail_addressCreated_at
    String sEmail_addressUpdated_at
    String sEmail_addressOpt_in_source
    String sEmail_addressOpt_in_date
    String sEmail_addressConfirm_status
    String sFirst_name
    String sLast_name
    String sJob_title
    String sCompany_name
    Integer iBirthday_month
    Integer iBirthday_day
    String sAnniversary
    String sCreate_source
    String sCreated_at
    String sUpdated_at
    Integer i
    Integer iCount_i
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Implements the following CURL command:

    // curl -X GET \
    //   'https://api.cc.email/v3/contacts?email=new_contact_email&status=all' \
    //   -H 'Accept: application/json' \
    //   -H 'Authorization: Bearer ACCESS_TOKEN' \
    //   -H 'Content-Type: application/json' \
    //   -H 'Postman-Token: 98980ee6-b99f-41a9-9a7a-3b5651d2ea7f' \
    //   -H 'cache-control: no-cache'

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

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"
    // Adds the "Authorization: Bearer ACCESS_TOKEN" header.
    Set ComAuthToken Of hoHttp To "ACCESS_TOKEN"
    Send ComSetRequestHeader To hoHttp "Postman-Token" "98980ee6-b99f-41a9-9a7a-3b5651d2ea7f"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
    Send ComSetRequestHeader To hoHttp "cache-control" "no-cache"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.cc.email/v3/contacts?email=danipper@example.com&status=all" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    // {
    //   "contacts": [
    //     {
    //       "contact_id": "8207fa8e-13dd-11eb-8a66-fa163e37306a",
    //       "email_address": {
    //         "address": "danipper@example.com",
    //         "permission_to_send": "implicit",
    //         "created_at": "2020-10-21T20:39:25Z",
    //         "updated_at": "2020-10-21T20:39:25Z",
    //         "opt_in_source": "Account",
    //         "opt_in_date": "2020-10-21T20:39:25Z",
    //         "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": "2020-10-21T20:39:25Z",
    //       "updated_at": "2020-10-21T20:39:25Z"
    //     }
    //   ]
    // }

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

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "contacts" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "contacts[i].contact_id" To sContact_id
        Get ComStringOf Of hoJResp "contacts[i].email_address.address" To sEmail_addressAddress
        Get ComStringOf Of hoJResp "contacts[i].email_address.permission_to_send" To sEmail_addressPermission_to_send
        Get ComStringOf Of hoJResp "contacts[i].email_address.created_at" To sEmail_addressCreated_at
        Get ComStringOf Of hoJResp "contacts[i].email_address.updated_at" To sEmail_addressUpdated_at
        Get ComStringOf Of hoJResp "contacts[i].email_address.opt_in_source" To sEmail_addressOpt_in_source
        Get ComStringOf Of hoJResp "contacts[i].email_address.opt_in_date" To sEmail_addressOpt_in_date
        Get ComStringOf Of hoJResp "contacts[i].email_address.confirm_status" To sEmail_addressConfirm_status
        Get ComStringOf Of hoJResp "contacts[i].first_name" To sFirst_name
        Get ComStringOf Of hoJResp "contacts[i].last_name" To sLast_name
        Get ComStringOf Of hoJResp "contacts[i].job_title" To sJob_title
        Get ComStringOf Of hoJResp "contacts[i].company_name" To sCompany_name
        Get ComIntOf Of hoJResp "contacts[i].birthday_month" To iBirthday_month
        Get ComIntOf Of hoJResp "contacts[i].birthday_day" To iBirthday_day
        Get ComStringOf Of hoJResp "contacts[i].anniversary" To sAnniversary
        Get ComStringOf Of hoJResp "contacts[i].create_source" To sCreate_source
        Get ComStringOf Of hoJResp "contacts[i].created_at" To sCreated_at
        Get ComStringOf Of hoJResp "contacts[i].updated_at" To sUpdated_at
        Move (i + 1) To i
    Loop



End_Procedure

 

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