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

DataFlex 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

 

 

 

(DataFlex) GetHarvest - Test Personal Access Token

Demonstrates how to test your GetHarvest Personal Access Token

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    Integer iId
    String sFirst_name
    String sLast_name
    String sEmail
    String sTelephone
    String sTimezone
    Integer iWeekly_capacity
    Boolean iHas_access_to_all_future_projects
    Boolean iIs_contractor
    Boolean iIs_admin
    Boolean iIs_project_manager
    Boolean iCan_see_rates
    Boolean iCan_create_projects
    Boolean iCan_create_invoices
    Boolean iIs_active
    String sCreated_at
    String sUpdated_at
    String sDefault_hourly_rate
    String sCost_rate
    String sAvatar_url
    Integer i
    Integer iCount_i
    String sStrVal
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComSetRequestHeader To hoHttp "User-Agent" "Harvest API Example"
    Send ComSetRequestHeader To hoHttp "Harvest-Account-ID" "ACCOUNT_ID"
    Send ComSetRequestHeader To hoHttp "Authorization" "Bearer ACCESS_TOKEN"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.harvestapp.com/api/v2/users/me.json" vSbResponseBody To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode

    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastResponseHeader Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Sample JSON response:

    // {
    //   "id": 2826142,
    //   "first_name": "Joe",
    //   "last_name": "Johnson",
    //   "email": "joe@example.com",
    //   "telephone": "",
    //   "timezone": "Central Time (US & Canada)",
    //   "weekly_capacity": 126000,
    //   "has_access_to_all_future_projects": false,
    //   "is_contractor": false,
    //   "is_admin": true,
    //   "is_project_manager": false,
    //   "can_see_rates": true,
    //   "can_create_projects": true,
    //   "can_create_invoices": true,
    //   "is_active": true,
    //   "created_at": "2019-06-06T15:57:58Z",
    //   "updated_at": "2019-06-06T15:58:32Z",
    //   "default_hourly_rate": 175.0,
    //   "cost_rate": 60.0,
    //   "roles": [
    //     "role1",
    //     "role2"
    //   ],
    //   "avatar_url": "https://d3s3969qhosaug.cloudfront.net/default-avatars/4d46.png?1559836678"
    // }

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

    Get ComIntOf Of hoJResp "id" To iId
    Get ComStringOf Of hoJResp "first_name" To sFirst_name
    Get ComStringOf Of hoJResp "last_name" To sLast_name
    Get ComStringOf Of hoJResp "email" To sEmail
    Get ComStringOf Of hoJResp "telephone" To sTelephone
    Get ComStringOf Of hoJResp "timezone" To sTimezone
    Get ComIntOf Of hoJResp "weekly_capacity" To iWeekly_capacity
    Get ComBoolOf Of hoJResp "has_access_to_all_future_projects" To iHas_access_to_all_future_projects
    Get ComBoolOf Of hoJResp "is_contractor" To iIs_contractor
    Get ComBoolOf Of hoJResp "is_admin" To iIs_admin
    Get ComBoolOf Of hoJResp "is_project_manager" To iIs_project_manager
    Get ComBoolOf Of hoJResp "can_see_rates" To iCan_see_rates
    Get ComBoolOf Of hoJResp "can_create_projects" To iCan_create_projects
    Get ComBoolOf Of hoJResp "can_create_invoices" To iCan_create_invoices
    Get ComBoolOf Of hoJResp "is_active" To iIs_active
    Get ComStringOf Of hoJResp "created_at" To sCreated_at
    Get ComStringOf Of hoJResp "updated_at" To sUpdated_at
    Get ComStringOf Of hoJResp "default_hourly_rate" To sDefault_hourly_rate
    Get ComStringOf Of hoJResp "cost_rate" To sCost_rate
    Get ComStringOf Of hoJResp "avatar_url" To sAvatar_url
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "roles" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "roles[i]" To sStrVal
        Move (i + 1) To i
    Loop



End_Procedure

 

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