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

DataFlex 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

 

 

 

(DataFlex) Activix CRM Create a Phone

Create a phone. Returns the created phone.

For more information, see https://docs.crm.activix.ca/api/resources/phone

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Handle hoJsonRequestBody
    String sUrl
    Variant vResp
    Handle hoResp
    Handle hoJsonResponse
    Integer iDataId
    String sDataCreated_at
    String sDataUpdated_at
    Integer iDataLead_id
    String sDataExtension
    String sDataNumber
    String sDataType
    Boolean iDataValid
    String sDataValidated
    Boolean iDataMobile
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // This example requires 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

    Set ComAuthToken Of hoHttp To "ACCESS_TOKEN"

    Set ComAccept Of hoHttp To "application/json"

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

    // {
    //   "lead_id": 7135833,
    //   "number": "+15141234455",
    //   "type": "home"
    // }

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

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonRequestBody
    If (Not(IsComObjectCreated(hoJsonRequestBody))) Begin
        Send CreateComObject of hoJsonRequestBody
    End
    Get ComUpdateInt Of hoJsonRequestBody "lead_id" 7135833 To iSuccess
    Get ComUpdateString Of hoJsonRequestBody "number" "+15141234455" To iSuccess
    Get ComUpdateString Of hoJsonRequestBody "type" "home" To iSuccess

    Move "https://crm.activix.ca/api/v2/lead-phones" To sUrl

    Get ComEmit Of hoJsonRequestBody To sTemp1
    Get ComPText Of hoHttp "POST" sUrl sTemp1 "utf-8" "application/json" False False To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStatusCode Of hoResp To iTemp1
    Showln "Response Status Code: " iTemp1

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
    If (Not(IsComObjectCreated(hoJsonResponse))) Begin
        Send CreateComObject of hoJsonResponse
    End
    Get ComBodyStr Of hoResp To sTemp1
    Get ComLoad Of hoJsonResponse sTemp1 To iSuccess
    Set ComEmitCompact Of hoJsonResponse To False
    Get ComEmit Of hoJsonResponse To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iTemp1
    If (iTemp1 >= 300) Begin
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

    // Sample output...
    // (See the parsing code below..)
    // 
    // Use the this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    // {
    //     "data": {
    //         "id": 34566,
    //         "created_at": "2018-04-09T18:05:00+00:00",
    //         "updated_at": "2018-04-09T18:05:00+00:00",
    //         "lead_id": 3466512,
    //         "number": "+15141234455",
    //         ...
    //     }
    // }

    Get ComIntOf Of hoJsonResponse "data.id" To iDataId
    Get ComStringOf Of hoJsonResponse "data.created_at" To sDataCreated_at
    Get ComStringOf Of hoJsonResponse "data.updated_at" To sDataUpdated_at
    Get ComIntOf Of hoJsonResponse "data.lead_id" To iDataLead_id
    Get ComStringOf Of hoJsonResponse "data.extension" To sDataExtension
    Get ComStringOf Of hoJsonResponse "data.number" To sDataNumber
    Get ComStringOf Of hoJsonResponse "data.type" To sDataType
    Get ComBoolOf Of hoJsonResponse "data.valid" To iDataValid
    Get ComStringOf Of hoJsonResponse "data.validated" To sDataValidated
    Get ComBoolOf Of hoJsonResponse "data.mobile" To iDataMobile


End_Procedure

 

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