Chilkat Examples

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

Visual FoxPro Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(Visual FoxPro) Activix CRM Update a Phone

Updates a phone and returns the updated phone.

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

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL loJsonRequestBody
LOCAL lcUrl
LOCAL loResp
LOCAL loJsonResponse
LOCAL lnDataId
LOCAL lcDataCreated_at
LOCAL lcDataUpdated_at
LOCAL lnDataLead_id
LOCAL lcDataExtension
LOCAL lcDataNumber
LOCAL lcDataType
LOCAL lnDataValid
LOCAL lnDataValidated
LOCAL lnDataMobile

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

loHttp.AuthToken = "ACCESS_TOKEN"

loHttp.Accept = "application/json"

* The following JSON is sent in the request body:

* {
*   "number": "+15141234459",
*   "type": "home",
*   "mobile": true
* }

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

loJsonRequestBody = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonRequestBody.UpdateString("number","+15141234459")
loJsonRequestBody.UpdateString("type","home")
loJsonRequestBody.UpdateBool("mobile",1)

lcUrl = "https://crm.activix.ca/api/v2/lead-phones/PHONE_ID"

loResp = loHttp.PText("PUT",lcUrl,loJsonRequestBody.Emit(),"utf-8","application/json",0,0)
IF (loHttp.LastMethodSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJsonRequestBody
    CANCEL
ENDIF

? "Response Status Code: " + STR(loResp.StatusCode)

loJsonResponse = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonResponse.Load(loResp.BodyStr)
loJsonResponse.EmitCompact = 0
? loJsonResponse.Emit()

IF (loResp.StatusCode >= 300) THEN
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loJsonRequestBody
    RELEASE loJsonResponse
    CANCEL
ENDIF

RELEASE loResp

* 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:07:00+00:00",
*         "lead_id": 3466512,
*         "number": "+15141234455",
*         ...
*     }
* }

lnDataId = loJsonResponse.IntOf("data.id")
lcDataCreated_at = loJsonResponse.StringOf("data.created_at")
lcDataUpdated_at = loJsonResponse.StringOf("data.updated_at")
lnDataLead_id = loJsonResponse.IntOf("data.lead_id")
lcDataExtension = loJsonResponse.StringOf("data.extension")
lcDataNumber = loJsonResponse.StringOf("data.number")
lcDataType = loJsonResponse.StringOf("data.type")
lnDataValid = loJsonResponse.BoolOf("data.valid")
lnDataValidated = loJsonResponse.BoolOf("data.validated")
lnDataMobile = loJsonResponse.BoolOf("data.mobile")

RELEASE loHttp
RELEASE loJsonRequestBody
RELEASE loJsonResponse


 

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