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

Visual FoxPro 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
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(Visual FoxPro) SugarCRM Updating a Record

Demonstrates how to update a record in the Sugar instance using the //:record endpoint, and the PUT Http method. In this example we update the Account record and change it's name to "Updated Test Record".

For more information, see https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Integration/Web_Services/v10/Examples/Bash/How_to_Manipulate_Records_CRUD/#Updating_a_Record

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcId
LOCAL lcName
LOCAL lcDate_entered
LOCAL lcDate_modified
LOCAL lcModified_user_id
LOCAL lcModified_by_name
LOCAL lcModified_user_linkFull_name
LOCAL lcModified_user_linkId
LOCAL lcModified_user_link_aclDelete
LOCAL lcModified_user_link_acl_hash
LOCAL lcCreated_by
LOCAL lcCreated_by_name
LOCAL lcCreated_by_linkFull_name
LOCAL lcCreated_by_linkId
LOCAL lcCreated_by_link_aclDelete
LOCAL lcCreated_by_link_acl_hash
LOCAL lcDescription
LOCAL lnDeleted
LOCAL lcFacebook
LOCAL lcTwitter
LOCAL lcGoogleplus
LOCAL lcAccount_type
LOCAL lcIndustry
LOCAL lcAnnual_revenue
LOCAL lcPhone_fax
LOCAL lcBilling_address_street
LOCAL lcBilling_address_street_2
LOCAL lcBilling_address_street_3
LOCAL lcBilling_address_street_4
LOCAL lcBilling_address_city
LOCAL lcBilling_address_state
LOCAL lcBilling_address_postalcode
LOCAL lcBilling_address_country
LOCAL lcRating
LOCAL lcPhone_office
LOCAL lcPhone_alternate
LOCAL lcWebsite
LOCAL lcOwnership
LOCAL lcEmployees
LOCAL lcTicker_symbol
LOCAL lcShipping_address_street
LOCAL lcShipping_address_street_2
LOCAL lcShipping_address_street_3
LOCAL lcShipping_address_street_4
LOCAL lcShipping_address_city
LOCAL lcShipping_address_state
LOCAL lcShipping_address_postalcode
LOCAL lcShipping_address_country
LOCAL lcParent_id
LOCAL lcSic_code
LOCAL lcDuns_num
LOCAL lcParent_name
LOCAL lcMember_ofName
LOCAL lcMember_ofId
LOCAL lcMember_of_acl_hash
LOCAL lcCampaign_id
LOCAL lcCampaign_name
LOCAL lcCampaign_accountsName
LOCAL lcCampaign_accountsId
LOCAL lcCampaign_accounts_acl_hash
LOCAL lnFollowing
LOCAL lnMy_favorite
LOCAL lcAssigned_user_id
LOCAL lcAssigned_user_name
LOCAL lcAssigned_user_linkFull_name
LOCAL lcAssigned_user_linkId
LOCAL lcAssigned_user_link_acl_hash
LOCAL lcTeam_count
LOCAL lcTeam_count_linkTeam_count
LOCAL lcTeam_count_linkId
LOCAL lcTeam_count_link_acl_hash
LOCAL lcEmail1
LOCAL lcEmail2
LOCAL lnInvalid_email
LOCAL lnEmail_opt_out
LOCAL lcEmail_addresses_non_primary
LOCAL lcV_module
LOCAL i
LOCAL lnCount_i
LOCAL lnId_int
LOCAL lcName_2
LOCAL lnPrimary
LOCAL lcEmail_address
LOCAL lnOpt_out
LOCAL lnPrimary_address
LOCAL lnReply_to_address

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* Implements the following CURL command:

* curl -X PUT -H OAuth-Token:<access_token> -H Cache-Control:no-cache -d '{ 
*    "name":"Updated Record"
* }' http://<site_url>/rest/v10/Accounts/<record_id>

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

* The following JSON is sent in the request body.

* {
*   "name": "Updated Record"
* }

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("name","Updated Record")

loHttp.SetRequestHeader("Cache-Control","no-cache")
loHttp.SetRequestHeader("OAuth-Token","<access_token>")

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbRequestBody = CreateObject('Chilkat.StringBuilder')
loJson.EmitSb(loSbRequestBody)

loResp = loHttp.PTextSb("PUT","http://<site_url>/rest/v10/Accounts/<record_id>",loSbRequestBody,"utf-8","application/json",0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbRequestBody
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbRequestBody
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

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

* {
*   "id": "ab2222df-73da-0e92-6887-5705428f4d68",
*   "name": "Updated Test Record",
*   "date_entered": "2016-04-06T15:03:21-04:00",
*   "date_modified": "2016-04-06T15:03:22-04:00",
*   "modified_user_id": "1",
*   "modified_by_name": "Administrator",
*   "modified_user_link": {
*     "full_name": "Administrator",
*     "id": "1",
*     "_acl": {
*       "fields": [
*       ],
*       "delete": "no",
*       "_hash": "8e11bf9be8f04daddee9d08d44ea891e"
*     }
*   },
*   "created_by": "1",
*   "created_by_name": "Administrator",
*   "created_by_link": {
*     "full_name": "Administrator",
*     "id": "1",
*     "_acl": {
*       "fields": [
*       ],
*       "delete": "no",
*       "_hash": "8e11bf9be8f04daddee9d08d44ea891e"
*     }
*   },
*   "description": "",
*   "deleted": false,
*   "facebook": "",
*   "twitter": "",
*   "googleplus": "",
*   "account_type": "",
*   "industry": "",
*   "annual_revenue": "",
*   "phone_fax": "",
*   "billing_address_street": "",
*   "billing_address_street_2": "",
*   "billing_address_street_3": "",
*   "billing_address_street_4": "",
*   "billing_address_city": "",
*   "billing_address_state": "",
*   "billing_address_postalcode": "",
*   "billing_address_country": "",
*   "rating": "",
*   "phone_office": "",
*   "phone_alternate": "",
*   "website": "",
*   "ownership": "",
*   "employees": "",
*   "ticker_symbol": "",
*   "shipping_address_street": "",
*   "shipping_address_street_2": "",
*   "shipping_address_street_3": "",
*   "shipping_address_street_4": "",
*   "shipping_address_city": "",
*   "shipping_address_state": "",
*   "shipping_address_postalcode": "",
*   "shipping_address_country": "",
*   "parent_id": "",
*   "sic_code": "",
*   "duns_num": "",
*   "parent_name": "",
*   "member_of": {
*     "name": "",
*     "id": "",
*     "_acl": {
*       "fields": [
*       ],
*       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
*     }
*   },
*   "campaign_id": "",
*   "campaign_name": "",
*   "campaign_accounts": {
*     "name": "",
*     "id": "",
*     "_acl": {
*       "fields": [
*       ],
*       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
*     }
*   },
*   "following": true,
*   "my_favorite": false,
*   "tag": [
*   ],
*   "assigned_user_id": "",
*   "assigned_user_name": "",
*   "assigned_user_link": {
*     "full_name": "",
*     "id": "",
*     "_acl": {
*       "fields": [
*       ],
*       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
*     }
*   },
*   "team_count": "",
*   "team_count_link": {
*     "team_count": "",
*     "id": "1",
*     "_acl": {
*       "fields": [
*       ],
*       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
*     }
*   },
*   "team_name": [
*     {
*       "id": 1,
*       "name": "Global",
*       "name_2": "",
*       "primary": true
*     }
*   ],
*   "email": [
*     {
*       "email_address": "test@sugar.com",
*       "invalid_email": false,
*       "opt_out": false,
*       "primary_address": true,
*       "reply_to_address": false
*     }
*   ],
*   "email1": "test@sugar.com",
*   "email2": "",
*   "invalid_email": false,
*   "email_opt_out": false,
*   "email_addresses_non_primary": "",
*   "_acl": {
*     "fields": {}
*   },
*   "_module": "Accounts"
* }

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

lcId = loJResp.StringOf("id")
lcName = loJResp.StringOf("name")
lcDate_entered = loJResp.StringOf("date_entered")
lcDate_modified = loJResp.StringOf("date_modified")
lcModified_user_id = loJResp.StringOf("modified_user_id")
lcModified_by_name = loJResp.StringOf("modified_by_name")
lcModified_user_linkFull_name = loJResp.StringOf("modified_user_link.full_name")
lcModified_user_linkId = loJResp.StringOf("modified_user_link.id")
lcModified_user_link_aclDelete = loJResp.StringOf("modified_user_link._acl.delete")
lcModified_user_link_acl_hash = loJResp.StringOf("modified_user_link._acl._hash")
lcCreated_by = loJResp.StringOf("created_by")
lcCreated_by_name = loJResp.StringOf("created_by_name")
lcCreated_by_linkFull_name = loJResp.StringOf("created_by_link.full_name")
lcCreated_by_linkId = loJResp.StringOf("created_by_link.id")
lcCreated_by_link_aclDelete = loJResp.StringOf("created_by_link._acl.delete")
lcCreated_by_link_acl_hash = loJResp.StringOf("created_by_link._acl._hash")
lcDescription = loJResp.StringOf("description")
lnDeleted = loJResp.BoolOf("deleted")
lcFacebook = loJResp.StringOf("facebook")
lcTwitter = loJResp.StringOf("twitter")
lcGoogleplus = loJResp.StringOf("googleplus")
lcAccount_type = loJResp.StringOf("account_type")
lcIndustry = loJResp.StringOf("industry")
lcAnnual_revenue = loJResp.StringOf("annual_revenue")
lcPhone_fax = loJResp.StringOf("phone_fax")
lcBilling_address_street = loJResp.StringOf("billing_address_street")
lcBilling_address_street_2 = loJResp.StringOf("billing_address_street_2")
lcBilling_address_street_3 = loJResp.StringOf("billing_address_street_3")
lcBilling_address_street_4 = loJResp.StringOf("billing_address_street_4")
lcBilling_address_city = loJResp.StringOf("billing_address_city")
lcBilling_address_state = loJResp.StringOf("billing_address_state")
lcBilling_address_postalcode = loJResp.StringOf("billing_address_postalcode")
lcBilling_address_country = loJResp.StringOf("billing_address_country")
lcRating = loJResp.StringOf("rating")
lcPhone_office = loJResp.StringOf("phone_office")
lcPhone_alternate = loJResp.StringOf("phone_alternate")
lcWebsite = loJResp.StringOf("website")
lcOwnership = loJResp.StringOf("ownership")
lcEmployees = loJResp.StringOf("employees")
lcTicker_symbol = loJResp.StringOf("ticker_symbol")
lcShipping_address_street = loJResp.StringOf("shipping_address_street")
lcShipping_address_street_2 = loJResp.StringOf("shipping_address_street_2")
lcShipping_address_street_3 = loJResp.StringOf("shipping_address_street_3")
lcShipping_address_street_4 = loJResp.StringOf("shipping_address_street_4")
lcShipping_address_city = loJResp.StringOf("shipping_address_city")
lcShipping_address_state = loJResp.StringOf("shipping_address_state")
lcShipping_address_postalcode = loJResp.StringOf("shipping_address_postalcode")
lcShipping_address_country = loJResp.StringOf("shipping_address_country")
lcParent_id = loJResp.StringOf("parent_id")
lcSic_code = loJResp.StringOf("sic_code")
lcDuns_num = loJResp.StringOf("duns_num")
lcParent_name = loJResp.StringOf("parent_name")
lcMember_ofName = loJResp.StringOf("member_of.name")
lcMember_ofId = loJResp.StringOf("member_of.id")
lcMember_of_acl_hash = loJResp.StringOf("member_of._acl._hash")
lcCampaign_id = loJResp.StringOf("campaign_id")
lcCampaign_name = loJResp.StringOf("campaign_name")
lcCampaign_accountsName = loJResp.StringOf("campaign_accounts.name")
lcCampaign_accountsId = loJResp.StringOf("campaign_accounts.id")
lcCampaign_accounts_acl_hash = loJResp.StringOf("campaign_accounts._acl._hash")
lnFollowing = loJResp.BoolOf("following")
lnMy_favorite = loJResp.BoolOf("my_favorite")
lcAssigned_user_id = loJResp.StringOf("assigned_user_id")
lcAssigned_user_name = loJResp.StringOf("assigned_user_name")
lcAssigned_user_linkFull_name = loJResp.StringOf("assigned_user_link.full_name")
lcAssigned_user_linkId = loJResp.StringOf("assigned_user_link.id")
lcAssigned_user_link_acl_hash = loJResp.StringOf("assigned_user_link._acl._hash")
lcTeam_count = loJResp.StringOf("team_count")
lcTeam_count_linkTeam_count = loJResp.StringOf("team_count_link.team_count")
lcTeam_count_linkId = loJResp.StringOf("team_count_link.id")
lcTeam_count_link_acl_hash = loJResp.StringOf("team_count_link._acl._hash")
lcEmail1 = loJResp.StringOf("email1")
lcEmail2 = loJResp.StringOf("email2")
lnInvalid_email = loJResp.BoolOf("invalid_email")
lnEmail_opt_out = loJResp.BoolOf("email_opt_out")
lcEmail_addresses_non_primary = loJResp.StringOf("email_addresses_non_primary")
lcV_module = loJResp.StringOf("_module")
i = 0
lnCount_i = loJResp.SizeOfArray("modified_user_link._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("created_by_link._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("member_of._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("campaign_accounts._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("tag")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("assigned_user_link._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("team_count_link._acl.fields")
DO WHILE i < lnCount_i
    loJResp.I = i
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("team_name")
DO WHILE i < lnCount_i
    loJResp.I = i
    lnId_int = loJResp.IntOf("team_name[i].id")
    lcName = loJResp.StringOf("team_name[i].name")
    lcName_2 = loJResp.StringOf("team_name[i].name_2")
    lnPrimary = loJResp.BoolOf("team_name[i].primary")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("email")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcEmail_address = loJResp.StringOf("email[i].email_address")
    lnInvalid_email = loJResp.BoolOf("email[i].invalid_email")
    lnOpt_out = loJResp.BoolOf("email[i].opt_out")
    lnPrimary_address = loJResp.BoolOf("email[i].primary_address")
    lnReply_to_address = loJResp.BoolOf("email[i].reply_to_address")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJResp


 

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