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

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

 

 

 

(Xojo Plugin) Zoom API - Create JWT to Authenticate API Requests

See more Zoom Examples

Creates a JWT for the Zoom API.

For more information, see https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#using-jwt

Chilkat Xojo Plugin Download

Xojo Plugin for Windows, Linux, Mac OS X, and ARM, ARM64

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

// Use your API key and secret here...
Dim apiKey As String
apiKey = "o9rw6Gq0RnqlkfaSqtCMOA"
Dim apiSecret As String
apiSecret = "UslmE23Kjh7at9z3If1xAHEyLmPDNxvxQrjR"

// Create a JWT to authenticate Zoom API requests.
Dim jwt As New Chilkat.Jwt

Dim jose As New Chilkat.JsonObject
Dim success As Boolean
success = jose.UpdateString("alg","HS256")
success = jose.UpdateString("typ","JWT")

// Build claims to look like this:
// {"aud":null,"iss":"o9rw6Gq0RnqlkfaSqtCMOA","exp":1627651762,"iat":1627646363}
Dim claims As New Chilkat.JsonObject
success = claims.UpdateString("iss",apiKey)
success = claims.UpdateNull("aud")

// Set the timestamp of when the JWT was created to now.
Dim curDateTime As Int32
curDateTime = jwt.GenNumericDate(0)
success = claims.AddIntAt(-1,"iat",curDateTime)

// Set the timestamp defining an expiration time (end time) for the token
// to be now + 1 month(3600 * 24 * 30 seconds)
Dim oneMonth As Int32
oneMonth = 3600 * 24 * 30
success = claims.AddIntAt(-1,"exp",curDateTime + oneMonth)

// Produce the smallest possible JWT:
jwt.AutoCompact = True

Dim strJwt As String
strJwt = jwt.CreateJwt(jose.Emit(),claims.Emit(),apiSecret)

System.DebugLog(strJwt)

// Let's test the JWT to by sending the following request:

// curl --request GET \
//   --url 'https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1' \
//   --header 'authorization: Bearer { your_token }' \
//   --header 'content-type: application/json

Dim http As New Chilkat.Http

// Implements the following CURL command:

// curl --request GET \
//   --url 'https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1' \
//   --header 'authorization: Bearer { your_token }' \
//   --header 'content-type: application/json

// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code

http.SetRequestHeader "content-type","application/json"
// Adds the "Authorization: Bearer { your_token }" header.
http.AuthToken = strJwt

Dim sbResponseBody As New Chilkat.StringBuilder
success = http.QuickGetSb("https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1",sbResponseBody)
If (success = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

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

System.DebugLog("Response Body:")
System.DebugLog(jResp.Emit())

Dim respStatusCode As Int32
respStatusCode = http.LastStatus
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode >= 400) Then
    System.DebugLog("Response Header:")
    System.DebugLog(http.LastHeader)
    System.DebugLog("Failed.")
    Return
End If

// Sample output:

// {
//   "page_count": 1,
//   "page_number": 1,
//   "page_size": 30,
//   "total_records": 1,
//   "users": [
//     {
//       "id": "s8uAiMJiRmS_-eu1yOhKlg",
//       "first_name": "Joe",
//       "last_name": "Example",
//       "email": "joe@example.com",
//       "type": 1,
//       "pmi": 5224934114,
//       "timezone": "America/Chicago",
//       "verified": 1,
//       "created_at": "2021-07-30T11:56:37Z",
//       "last_login_time": "2021-07-30T11:56:37Z",
//       "language": "en-US",
//       "phone_number": "",
//       "status": "active",
//       "role_id": "0"
//     }
//   ]
// }

// 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 String
Dim first_name As String
Dim last_name As String
Dim email As String
Dim v_type As Int32
Dim pmi As Int32
Dim timezone As String
Dim verified As Int32
Dim created_at As String
Dim last_login_time As String
Dim language As String
Dim phone_number As String
Dim status As String
Dim role_id As String

Dim page_count As Int32
page_count = jResp.IntOf("page_count")
Dim page_number As Int32
page_number = jResp.IntOf("page_number")
Dim page_size As Int32
page_size = jResp.IntOf("page_size")
Dim total_records As Int32
total_records = jResp.IntOf("total_records")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("users")
While i < count_i
    jResp.I = i
    id = jResp.StringOf("users[i].id")
    first_name = jResp.StringOf("users[i].first_name")
    last_name = jResp.StringOf("users[i].last_name")
    email = jResp.StringOf("users[i].email")
    v_type = jResp.IntOf("users[i].type")
    pmi = jResp.IntOf("users[i].pmi")
    timezone = jResp.StringOf("users[i].timezone")
    verified = jResp.IntOf("users[i].verified")
    created_at = jResp.StringOf("users[i].created_at")
    last_login_time = jResp.StringOf("users[i].last_login_time")
    language = jResp.StringOf("users[i].language")
    phone_number = jResp.StringOf("users[i].phone_number")
    status = jResp.StringOf("users[i].status")
    role_id = jResp.StringOf("users[i].role_id")
    i = i + 1
Wend

 

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