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 Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Bitfinex v2 REST
Bluzone
BrickLink
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Mastercard

MedTunnel
MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
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
UniPin
VoiceBase
Vonage
Walmart
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yousign
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PowerBuilder) GetHarvest - Get Client Contacts

Returns a list of your contacts.

For more information, see https://help.getharvest.com/api-v2/clients-api/clients/contacts/

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
integer li_Per_page
integer li_Total_pages
integer li_Total_entries
string ls_Next_page
string ls_Previous_page
integer li_Page
string ls_LinksFirst
string ls_LinksNext
string ls_LinksPrevious
string ls_LinksLast
integer i
integer li_Count_i
integer li_Id
string ls_Title
string ls_First_name
string ls_Last_name
string ls_Email
string ls_Phone_office
string ls_Phone_mobile
string ls_Fax
string ls_Created_at
string ls_Updated_at
integer li_ClientId
string ls_ClientName

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.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 "https://api.harvestapp.com/v2/contacts" \
//   -H "Authorization: Bearer ACCESS_TOKEN" \
//   -H "Harvest-Account-Id: ACCOUNT_ID" \
//   -H "User-Agent: MyApp (yourname@example.com)"

loo_Http.SetRequestHeader("User-Agent","MyApp (yourname@example.com)")
loo_Http.SetRequestHeader("Authorization","Bearer ACCESS_TOKEN")
loo_Http.SetRequestHeader("Harvest-Account-Id","ACCOUNT_ID")

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

li_Success = loo_Http.QuickGetSb("https://api.harvestapp.com/v2/contacts",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

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

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// Sample JSON response:

// {
//   "contacts": [
//     {
//       "id": 4706479,
//       "title": "Owner",
//       "first_name": "Jane",
//       "last_name": "Doe",
//       "email": "janedoe@example.com",
//       "phone_office": "(203) 697-8885",
//       "phone_mobile": "(203) 697-8886",
//       "fax": "(203) 697-8887",
//       "created_at": "2017-06-26T21:20:07Z",
//       "updated_at": "2017-06-26T21:27:07Z",
//       "client": {
//         "id": 5735774,
//         "name": "ABC Corp"
//       }
//     },
//     {
//       "id": 4706453,
//       "title": "Manager",
//       "first_name": "Richard",
//       "last_name": "Roe",
//       "email": "richardroe@example.com",
//       "phone_office": "(318) 515-5905",
//       "phone_mobile": "(318) 515-5906",
//       "fax": "(318) 515-5907",
//       "created_at": "2017-06-26T21:06:55Z",
//       "updated_at": "2017-06-26T21:27:20Z",
//       "client": {
//         "id": 5735776,
//         "name": "123 Industries"
//       }
//     }
//   ],
//   "per_page": 100,
//   "total_pages": 1,
//   "total_entries": 2,
//   "next_page": null,
//   "previous_page": null,
//   "page": 1,
//   "links": {
//     "first": "https://api.harvestapp.com/v2/contacts?page=1&per_page=100",
//     "next": null,
//     "previous": null,
//     "last": "https://api.harvestapp.com/v2/contacts?page=1&per_page=100"
//   }
// }

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

li_Per_page = loo_JResp.IntOf("per_page")
li_Total_pages = loo_JResp.IntOf("total_pages")
li_Total_entries = loo_JResp.IntOf("total_entries")
ls_Next_page = loo_JResp.StringOf("next_page")
ls_Previous_page = loo_JResp.StringOf("previous_page")
li_Page = loo_JResp.IntOf("page")
ls_LinksFirst = loo_JResp.StringOf("links.first")
ls_LinksNext = loo_JResp.StringOf("links.next")
ls_LinksPrevious = loo_JResp.StringOf("links.previous")
ls_LinksLast = loo_JResp.StringOf("links.last")
i = 0
li_Count_i = loo_JResp.SizeOfArray("contacts")
do while i < li_Count_i
    loo_JResp.I = i
    li_Id = loo_JResp.IntOf("contacts[i].id")
    ls_Title = loo_JResp.StringOf("contacts[i].title")
    ls_First_name = loo_JResp.StringOf("contacts[i].first_name")
    ls_Last_name = loo_JResp.StringOf("contacts[i].last_name")
    ls_Email = loo_JResp.StringOf("contacts[i].email")
    ls_Phone_office = loo_JResp.StringOf("contacts[i].phone_office")
    ls_Phone_mobile = loo_JResp.StringOf("contacts[i].phone_mobile")
    ls_Fax = loo_JResp.StringOf("contacts[i].fax")
    ls_Created_at = loo_JResp.StringOf("contacts[i].created_at")
    ls_Updated_at = loo_JResp.StringOf("contacts[i].updated_at")
    li_ClientId = loo_JResp.IntOf("contacts[i].client.id")
    ls_ClientName = loo_JResp.StringOf("contacts[i].client.name")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

 

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