Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

VB.NET Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(VB.NET) GetHarvest - Test Personal Access Token

Demonstrates how to test your GetHarvest Personal Access Token

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

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

Dim http As New Chilkat.Http
Dim success As Boolean

http.SetRequestHeader("User-Agent","Harvest API Example")
http.SetRequestHeader("Harvest-Account-ID","ACCOUNT_ID")
http.SetRequestHeader("Authorization","Bearer ACCESS_TOKEN")

Dim sbResponseBody As New Chilkat.StringBuilder
success = http.QuickGetSb("https://api.harvestapp.com/api/v2/users/me.json",sbResponseBody)
If (success <> True) Then
    Debug.WriteLine(http.LastErrorText)
    Exit Sub
End If

Dim jResp As New Chilkat.JsonObject
jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False

Debug.WriteLine("Response Body:")
Debug.WriteLine(jResp.Emit())

Dim respStatusCode As Integer = http.LastStatus
Debug.WriteLine("Response Status Code = " & respStatusCode)

If (respStatusCode >= 400) Then
    Debug.WriteLine("Response Header:")
    Debug.WriteLine(http.LastResponseHeader)
    Exit Sub
End If


' 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

Dim id As Integer
Dim first_name As String
Dim last_name As String
Dim email As String
Dim telephone As String
Dim timezone As String
Dim weekly_capacity As Integer
Dim has_access_to_all_future_projects As Boolean
Dim is_contractor As Boolean
Dim is_admin As Boolean
Dim is_project_manager As Boolean
Dim can_see_rates As Boolean
Dim can_create_projects As Boolean
Dim can_create_invoices As Boolean
Dim is_active As Boolean
Dim created_at As String
Dim updated_at As String
Dim default_hourly_rate As String
Dim cost_rate As String
Dim avatar_url As String
Dim i As Integer
Dim count_i As Integer
Dim strVal As String

id = jResp.IntOf("id")
first_name = jResp.StringOf("first_name")
last_name = jResp.StringOf("last_name")
email = jResp.StringOf("email")
telephone = jResp.StringOf("telephone")
timezone = jResp.StringOf("timezone")
weekly_capacity = jResp.IntOf("weekly_capacity")
has_access_to_all_future_projects = jResp.BoolOf("has_access_to_all_future_projects")
is_contractor = jResp.BoolOf("is_contractor")
is_admin = jResp.BoolOf("is_admin")
is_project_manager = jResp.BoolOf("is_project_manager")
can_see_rates = jResp.BoolOf("can_see_rates")
can_create_projects = jResp.BoolOf("can_create_projects")
can_create_invoices = jResp.BoolOf("can_create_invoices")
is_active = jResp.BoolOf("is_active")
created_at = jResp.StringOf("created_at")
updated_at = jResp.StringOf("updated_at")
default_hourly_rate = jResp.StringOf("default_hourly_rate")
cost_rate = jResp.StringOf("cost_rate")
avatar_url = jResp.StringOf("avatar_url")
i = 0
count_i = jResp.SizeOfArray("roles")
While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("roles[i]")
    i = i + 1
End While

 

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