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
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

 

 

 

(PowerBuilder) 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

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_Name
string ls_Date_entered
string ls_Date_modified
string ls_Modified_user_id
string ls_Modified_by_name
string ls_Modified_user_linkFull_name
string ls_Modified_user_linkId
string ls_Modified_user_link_aclDelete
string ls_Modified_user_link_acl_hash
string ls_Created_by
string ls_Created_by_name
string ls_Created_by_linkFull_name
string ls_Created_by_linkId
string ls_Created_by_link_aclDelete
string ls_Created_by_link_acl_hash
string ls_Description
integer li_Deleted
string ls_Facebook
string ls_Twitter
string ls_Googleplus
string ls_Account_type
string ls_Industry
string ls_Annual_revenue
string ls_Phone_fax
string ls_Billing_address_street
string ls_Billing_address_street_2
string ls_Billing_address_street_3
string ls_Billing_address_street_4
string ls_Billing_address_city
string ls_Billing_address_state
string ls_Billing_address_postalcode
string ls_Billing_address_country
string ls_Rating
string ls_Phone_office
string ls_Phone_alternate
string ls_Website
string ls_Ownership
string ls_Employees
string ls_Ticker_symbol
string ls_Shipping_address_street
string ls_Shipping_address_street_2
string ls_Shipping_address_street_3
string ls_Shipping_address_street_4
string ls_Shipping_address_city
string ls_Shipping_address_state
string ls_Shipping_address_postalcode
string ls_Shipping_address_country
string ls_Parent_id
string ls_Sic_code
string ls_Duns_num
string ls_Parent_name
string ls_Member_ofName
string ls_Member_ofId
string ls_Member_of_acl_hash
string ls_Campaign_id
string ls_Campaign_name
string ls_Campaign_accountsName
string ls_Campaign_accountsId
string ls_Campaign_accounts_acl_hash
integer li_Following
integer li_My_favorite
string ls_Assigned_user_id
string ls_Assigned_user_name
string ls_Assigned_user_linkFull_name
string ls_Assigned_user_linkId
string ls_Assigned_user_link_acl_hash
string ls_Team_count
string ls_Team_count_linkTeam_count
string ls_Team_count_linkId
string ls_Team_count_link_acl_hash
string ls_Email1
string ls_Email2
integer li_Invalid_email
integer li_Email_opt_out
string ls_Email_addresses_non_primary
string ls_V_module
integer i
integer li_Count_i
integer li_Id_int
string ls_Name_2
integer li_Primary
string ls_Email_address
integer li_Opt_out
integer li_Primary_address
integer li_Reply_to_address

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.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 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"
// }

loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.UpdateString("name","Updated Record")

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

loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Json.EmitSb(loo_SbRequestBody)

loo_Resp = loo_Http.PTextSb("PUT","http://<site_url>/rest/v10/Accounts/<record_id>",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Json
    destroy loo_SbRequestBody
    return
end if

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.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_SbRequestBody
    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)

// {
//   "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

ls_Id = loo_JResp.StringOf("id")
ls_Name = loo_JResp.StringOf("name")
ls_Date_entered = loo_JResp.StringOf("date_entered")
ls_Date_modified = loo_JResp.StringOf("date_modified")
ls_Modified_user_id = loo_JResp.StringOf("modified_user_id")
ls_Modified_by_name = loo_JResp.StringOf("modified_by_name")
ls_Modified_user_linkFull_name = loo_JResp.StringOf("modified_user_link.full_name")
ls_Modified_user_linkId = loo_JResp.StringOf("modified_user_link.id")
ls_Modified_user_link_aclDelete = loo_JResp.StringOf("modified_user_link._acl.delete")
ls_Modified_user_link_acl_hash = loo_JResp.StringOf("modified_user_link._acl._hash")
ls_Created_by = loo_JResp.StringOf("created_by")
ls_Created_by_name = loo_JResp.StringOf("created_by_name")
ls_Created_by_linkFull_name = loo_JResp.StringOf("created_by_link.full_name")
ls_Created_by_linkId = loo_JResp.StringOf("created_by_link.id")
ls_Created_by_link_aclDelete = loo_JResp.StringOf("created_by_link._acl.delete")
ls_Created_by_link_acl_hash = loo_JResp.StringOf("created_by_link._acl._hash")
ls_Description = loo_JResp.StringOf("description")
li_Deleted = loo_JResp.BoolOf("deleted")
ls_Facebook = loo_JResp.StringOf("facebook")
ls_Twitter = loo_JResp.StringOf("twitter")
ls_Googleplus = loo_JResp.StringOf("googleplus")
ls_Account_type = loo_JResp.StringOf("account_type")
ls_Industry = loo_JResp.StringOf("industry")
ls_Annual_revenue = loo_JResp.StringOf("annual_revenue")
ls_Phone_fax = loo_JResp.StringOf("phone_fax")
ls_Billing_address_street = loo_JResp.StringOf("billing_address_street")
ls_Billing_address_street_2 = loo_JResp.StringOf("billing_address_street_2")
ls_Billing_address_street_3 = loo_JResp.StringOf("billing_address_street_3")
ls_Billing_address_street_4 = loo_JResp.StringOf("billing_address_street_4")
ls_Billing_address_city = loo_JResp.StringOf("billing_address_city")
ls_Billing_address_state = loo_JResp.StringOf("billing_address_state")
ls_Billing_address_postalcode = loo_JResp.StringOf("billing_address_postalcode")
ls_Billing_address_country = loo_JResp.StringOf("billing_address_country")
ls_Rating = loo_JResp.StringOf("rating")
ls_Phone_office = loo_JResp.StringOf("phone_office")
ls_Phone_alternate = loo_JResp.StringOf("phone_alternate")
ls_Website = loo_JResp.StringOf("website")
ls_Ownership = loo_JResp.StringOf("ownership")
ls_Employees = loo_JResp.StringOf("employees")
ls_Ticker_symbol = loo_JResp.StringOf("ticker_symbol")
ls_Shipping_address_street = loo_JResp.StringOf("shipping_address_street")
ls_Shipping_address_street_2 = loo_JResp.StringOf("shipping_address_street_2")
ls_Shipping_address_street_3 = loo_JResp.StringOf("shipping_address_street_3")
ls_Shipping_address_street_4 = loo_JResp.StringOf("shipping_address_street_4")
ls_Shipping_address_city = loo_JResp.StringOf("shipping_address_city")
ls_Shipping_address_state = loo_JResp.StringOf("shipping_address_state")
ls_Shipping_address_postalcode = loo_JResp.StringOf("shipping_address_postalcode")
ls_Shipping_address_country = loo_JResp.StringOf("shipping_address_country")
ls_Parent_id = loo_JResp.StringOf("parent_id")
ls_Sic_code = loo_JResp.StringOf("sic_code")
ls_Duns_num = loo_JResp.StringOf("duns_num")
ls_Parent_name = loo_JResp.StringOf("parent_name")
ls_Member_ofName = loo_JResp.StringOf("member_of.name")
ls_Member_ofId = loo_JResp.StringOf("member_of.id")
ls_Member_of_acl_hash = loo_JResp.StringOf("member_of._acl._hash")
ls_Campaign_id = loo_JResp.StringOf("campaign_id")
ls_Campaign_name = loo_JResp.StringOf("campaign_name")
ls_Campaign_accountsName = loo_JResp.StringOf("campaign_accounts.name")
ls_Campaign_accountsId = loo_JResp.StringOf("campaign_accounts.id")
ls_Campaign_accounts_acl_hash = loo_JResp.StringOf("campaign_accounts._acl._hash")
li_Following = loo_JResp.BoolOf("following")
li_My_favorite = loo_JResp.BoolOf("my_favorite")
ls_Assigned_user_id = loo_JResp.StringOf("assigned_user_id")
ls_Assigned_user_name = loo_JResp.StringOf("assigned_user_name")
ls_Assigned_user_linkFull_name = loo_JResp.StringOf("assigned_user_link.full_name")
ls_Assigned_user_linkId = loo_JResp.StringOf("assigned_user_link.id")
ls_Assigned_user_link_acl_hash = loo_JResp.StringOf("assigned_user_link._acl._hash")
ls_Team_count = loo_JResp.StringOf("team_count")
ls_Team_count_linkTeam_count = loo_JResp.StringOf("team_count_link.team_count")
ls_Team_count_linkId = loo_JResp.StringOf("team_count_link.id")
ls_Team_count_link_acl_hash = loo_JResp.StringOf("team_count_link._acl._hash")
ls_Email1 = loo_JResp.StringOf("email1")
ls_Email2 = loo_JResp.StringOf("email2")
li_Invalid_email = loo_JResp.BoolOf("invalid_email")
li_Email_opt_out = loo_JResp.BoolOf("email_opt_out")
ls_Email_addresses_non_primary = loo_JResp.StringOf("email_addresses_non_primary")
ls_V_module = loo_JResp.StringOf("_module")
i = 0
li_Count_i = loo_JResp.SizeOfArray("modified_user_link._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("created_by_link._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("member_of._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("campaign_accounts._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("tag")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("assigned_user_link._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("team_count_link._acl.fields")
do while i < li_Count_i
    loo_JResp.I = i
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("team_name")
do while i < li_Count_i
    loo_JResp.I = i
    li_Id_int = loo_JResp.IntOf("team_name[i].id")
    ls_Name = loo_JResp.StringOf("team_name[i].name")
    ls_Name_2 = loo_JResp.StringOf("team_name[i].name_2")
    li_Primary = loo_JResp.BoolOf("team_name[i].primary")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("email")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Email_address = loo_JResp.StringOf("email[i].email_address")
    li_Invalid_email = loo_JResp.BoolOf("email[i].invalid_email")
    li_Opt_out = loo_JResp.BoolOf("email[i].opt_out")
    li_Primary_address = loo_JResp.BoolOf("email[i].primary_address")
    li_Reply_to_address = loo_JResp.BoolOf("email[i].reply_to_address")
    i = i + 1
loop


destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp

 

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