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

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

 

 

 

(SQL Server) 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

// Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
//
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'User-Agent', 'Harvest API Example'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Harvest-Account-ID', 'ACCOUNT_ID'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Authorization', 'Bearer ACCESS_TOKEN'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.harvestapp.com/api/v2/users/me.json', @sbResponseBody
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END
    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode

    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastResponseHeader', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        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

    DECLARE @id int

    DECLARE @first_name nvarchar(4000)

    DECLARE @last_name nvarchar(4000)

    DECLARE @email nvarchar(4000)

    DECLARE @telephone nvarchar(4000)

    DECLARE @timezone nvarchar(4000)

    DECLARE @weekly_capacity int

    DECLARE @has_access_to_all_future_projects int

    DECLARE @is_contractor int

    DECLARE @is_admin int

    DECLARE @is_project_manager int

    DECLARE @can_see_rates int

    DECLARE @can_create_projects int

    DECLARE @can_create_invoices int

    DECLARE @is_active int

    DECLARE @created_at nvarchar(4000)

    DECLARE @updated_at nvarchar(4000)

    DECLARE @default_hourly_rate nvarchar(4000)

    DECLARE @cost_rate nvarchar(4000)

    DECLARE @avatar_url nvarchar(4000)

    DECLARE @i int

    DECLARE @count_i int

    DECLARE @strVal nvarchar(4000)

    EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'id'
    EXEC sp_OAMethod @jResp, 'StringOf', @first_name OUT, 'first_name'
    EXEC sp_OAMethod @jResp, 'StringOf', @last_name OUT, 'last_name'
    EXEC sp_OAMethod @jResp, 'StringOf', @email OUT, 'email'
    EXEC sp_OAMethod @jResp, 'StringOf', @telephone OUT, 'telephone'
    EXEC sp_OAMethod @jResp, 'StringOf', @timezone OUT, 'timezone'
    EXEC sp_OAMethod @jResp, 'IntOf', @weekly_capacity OUT, 'weekly_capacity'
    EXEC sp_OAMethod @jResp, 'BoolOf', @has_access_to_all_future_projects OUT, 'has_access_to_all_future_projects'
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_contractor OUT, 'is_contractor'
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_admin OUT, 'is_admin'
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_project_manager OUT, 'is_project_manager'
    EXEC sp_OAMethod @jResp, 'BoolOf', @can_see_rates OUT, 'can_see_rates'
    EXEC sp_OAMethod @jResp, 'BoolOf', @can_create_projects OUT, 'can_create_projects'
    EXEC sp_OAMethod @jResp, 'BoolOf', @can_create_invoices OUT, 'can_create_invoices'
    EXEC sp_OAMethod @jResp, 'BoolOf', @is_active OUT, 'is_active'
    EXEC sp_OAMethod @jResp, 'StringOf', @created_at OUT, 'created_at'
    EXEC sp_OAMethod @jResp, 'StringOf', @updated_at OUT, 'updated_at'
    EXEC sp_OAMethod @jResp, 'StringOf', @default_hourly_rate OUT, 'default_hourly_rate'
    EXEC sp_OAMethod @jResp, 'StringOf', @cost_rate OUT, 'cost_rate'
    EXEC sp_OAMethod @jResp, 'StringOf', @avatar_url OUT, 'avatar_url'
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'roles'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'roles[i]'
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

 

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