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

 

 

 

(PowerBuilder) SugarCRM Authenticate

Demonstrates how to authenticate to the SugarCRM REST v10 API. This is how an OAuth2 access token is obtained.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Rest
integer li_Success
oleobject loo_JsonReq
oleobject loo_SbReq
oleobject loo_SbJson
oleobject loo_Json
string ls_Access_token
integer li_Expires_in
string ls_Token_type
integer li_Scope
string ls_Refresh_token
integer li_Refresh_expires_in
string ls_Download_token

loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
    destroy loo_Rest
    MessageBox("Error","Connecting to COM object failed")
    return
end if

li_Success = loo_Rest.Connect("your.site.domain",443,1,1)
if li_Success <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    return
end if

loo_Rest.AddHeader("Cache-Control","no-cache")

// The following code creates the JSON request body.
// The JSON created by this code is shown below.
loo_JsonReq = create oleobject
li_rc = loo_JsonReq.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JsonReq.UpdateString("grant_type","password")
loo_JsonReq.UpdateString("client_id","sugar")
loo_JsonReq.UpdateString("client_secret","CLIENT_SECRET")
loo_JsonReq.UpdateString("username","admin")
loo_JsonReq.UpdateString("password","password")
loo_JsonReq.UpdateString("platform","custom_api")

// The JSON request body created by the above code:

// {
//   "grant_type": "password",
//   "client_id": "sugar",
//   "client_secret": "CLIENT_SECRET",
//   "username": "admin",
//   "password": "password",
//   "platform": "custom_api"
// }

loo_SbReq = create oleobject
li_rc = loo_SbReq.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_JsonReq.EmitSb(loo_SbReq)

loo_Rest.AddHeader("Content-Type","application/json")

loo_SbJson = create oleobject
li_rc = loo_SbJson.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

li_Success = loo_Rest.FullRequestSb("POST","/rest/v10/oauth2/token",loo_SbReq,loo_SbJson)
if li_Success <> 1 then
    Write-Debug loo_Rest.LastErrorText
    destroy loo_Rest
    destroy loo_JsonReq
    destroy loo_SbReq
    destroy loo_SbJson
    return
end if

if loo_Rest.ResponseStatusCode <> 200 then
    Write-Debug "Received error response code: " + string(loo_Rest.ResponseStatusCode)
    Write-Debug "Response body:"
    Write-Debug loo_SbJson.GetAsString()
    destroy loo_Rest
    destroy loo_JsonReq
    destroy loo_SbReq
    destroy loo_SbJson
    return
end if

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.LoadSb(loo_SbJson)

// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.

ls_Access_token = loo_Json.StringOf("access_token")
li_Expires_in = loo_Json.IntOf("expires_in")
ls_Token_type = loo_Json.StringOf("token_type")
li_Scope = loo_Json.IsNullOf("scope")
ls_Refresh_token = loo_Json.StringOf("refresh_token")
li_Refresh_expires_in = loo_Json.IntOf("refresh_expires_in")
ls_Download_token = loo_Json.StringOf("download_token")

// A sample JSON response body that is parsed by the above code:

// {
//   "access_token": "c6d495c9-bb25-81d2-5f81-533ef6479f9b",
//   "expires_in": 3600,
//   "token_type": "bearer",
//   "scope": null,
//   "refresh_token": "cbc40e67-12bc-4b56-a1d9-533ef62f2601",
//   "refresh_expires_in": 1209600,
//   "download_token": "cc5d1a9f-6627-3349-96e5-533ef6b1a493"
// }

Write-Debug "Example Completed."


destroy loo_Rest
destroy loo_JsonReq
destroy loo_SbReq
destroy loo_SbJson
destroy loo_Json

 

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