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

Visual FoxPro Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Visual FoxPro) Glacier Get Inventory Retrieval Job Output

Demonstrates how to get and parse the inventory retrieval job output.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loRest
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL lnSuccess
LOCAL loAuthAws
LOCAL loSbResponseBody
LOCAL lnRespStatusCode
LOCAL loCsv
LOCAL i
LOCAL lnNumRows

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rest')
loRest = CreateObject('Chilkat.Rest')

* Connect to the Amazon AWS REST server in the desired region.
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("glacier.us-west-2.amazonaws.com",lnPort,lnBTls,lnBAutoReconnect)

* Provide AWS credentials.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.AuthAws')
loAuthAws = CreateObject('Chilkat.AuthAws')
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.SecretKey = "AWS_SECRET_KEY"
loAuthAws.ServiceName = "glacier"
loAuthAws.Region = "us-west-2"

lnSuccess = loRest.SetAuthAws(loAuthAws)

* --------------------------------------------------------------------------
* Note: The above REST connection and setup of the AWS credentials
* can be done once.  After connecting, any number of REST calls can be made.
* The "auto reconnect" property passed to rest.Connect indicates that if
* the connection is lost, a REST method call will automatically reconnect
* if needed.
* --------------------------------------------------------------------------

* 
* For more information, see Glacier Retrieve Job Output Reference Documentation
* 
loRest.AddHeader("x-amz-glacier-version","2012-06-01")

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/AWS_ACCOUNT_ID/vaults/chilkat/jobs/JOB_ID/output",loSbResponseBody)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loAuthAws
    RELEASE loSbResponseBody
    CANCEL
ENDIF

lnRespStatusCode = loRest.ResponseStatusCode
IF (lnRespStatusCode >= 400) THEN
    ? "Response Status Code = " + STR(lnRespStatusCode)
    ? "Response Header:"
    ? loRest.ResponseHeader
    ? "Response Body:"
    ? loSbResponseBody.GetAsString()
    RELEASE loRest
    RELEASE loAuthAws
    RELEASE loSbResponseBody
    CANCEL
ENDIF

* Success is indicated by a 200 response status.
? "response status code = " + STR(lnRespStatusCode)

* The inventory retrieval job output is in CSV format.
? "job output:"
? loSbResponseBody.GetAsString()
? "--"

* The CSV has these fields:  ArchiveId,ArchiveDescription,CreationDate,Size,SHA256TreeHash
* Parse the CSV like this...
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Csv')
loCsv = CreateObject('Chilkat.Csv')
loCsv.HasColumnNames = 1
loCsv.LoadFromString(loSbResponseBody.GetAsString())

i = 0
lnNumRows = loCsv.NumRows
DO WHILE i < lnNumRows
    ? "ArchiveId: " + loCsv.GetCellByName(i,"ArchiveId")
    ? "Description: " + loCsv.GetCellByName(i,"ArchiveDescription")
    ? "Size: " + loCsv.GetCellByName(i,"Size")
    ? "-"
    i = i + 1
ENDDO

RELEASE loRest
RELEASE loAuthAws
RELEASE loSbResponseBody
RELEASE loCsv


 

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