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

Visual FoxPro Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
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
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Visual FoxPro) Glacier Get Job Information and Status

Demonstrates how to get information and status for a glacier job.

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 loJson
LOCAL lcAction
LOCAL lcArchiveId
LOCAL lcArchiveSHA256TreeHash
LOCAL lcArchiveSizeInBytes
LOCAL lnCompleted
LOCAL lcCompletionDate
LOCAL lcCreationDate
LOCAL lcInventoryRetrievalParametersEndDate
LOCAL lcInventoryRetrievalParametersFormat
LOCAL lcInventoryRetrievalParametersLimit
LOCAL lcInventoryRetrievalParametersMarker
LOCAL lcInventoryRetrievalParametersStartDate
LOCAL lcInventorySizeInBytes
LOCAL lcJobDescription
LOCAL lcJobId
LOCAL lcJobOutputPath
LOCAL lcOutputLocation
LOCAL lcRetrievalByteRange
LOCAL lcSHA256TreeHash
LOCAL lcSNSTopic
LOCAL lcSelectParameters
LOCAL lcStatusCode
LOCAL lcStatusMessage
LOCAL lcTier
LOCAL lcVaultARN

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

loRest = CreateObject('Chilkat_9_5_0.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.
loAuthAws = CreateObject('Chilkat_9_5_0.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 Describe Job Reference Documentation
* 
loRest.AddHeader("x-amz-glacier-version","2012-06-01")

loSbResponseBody = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/AWS_ACCOUNT_ID/vaults/chilkat/jobs/JOB_ID",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)

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.LoadSb(loSbResponseBody)
loJson.EmitCompact = 0
? loJson.Emit()

* Sample output:
* Use this online tool to generate parsing code from sample JSON: 
* Generate Parsing Code from JSON

* {
*   "Action": "InventoryRetrieval",
*   "ArchiveId": null,
*   "ArchiveSHA256TreeHash": null,
*   "ArchiveSizeInBytes": null,
*   "Completed": false,
*   "CompletionDate": null,
*   "CreationDate": "2019-04-09T22:48:48.700Z",
*   "InventoryRetrievalParameters": {
*     "EndDate": null,
*     "Format": "CSV",
*     "Limit": null,
*     "Marker": null,
*     "StartDate": null
*   },
*   "InventorySizeInBytes": null,
*   "JobDescription": "My inventory job",
*   "JobId": "E-mCnb3j122yvz5PRFGzETmFVXVrkX_pgI8PIuwBKNRyI8pAJqIetKwzkJC5a6blIvYZrrVohiBENQVhZE1a-K-x-uRO",
*   "JobOutputPath": null,
*   "OutputLocation": null,
*   "RetrievalByteRange": null,
*   "SHA256TreeHash": null,
*   "SNSTopic": null,
*   "SelectParameters": null,
*   "StatusCode": "InProgress",
*   "StatusMessage": null,
*   "Tier": null,
*   "VaultARN": "arn:aws:glacier:us-west-2:954491834127:vaults/chilkat"
* }
* 

lcAction = loJson.StringOf("Action")
lcArchiveId = loJson.StringOf("ArchiveId")
lcArchiveSHA256TreeHash = loJson.StringOf("ArchiveSHA256TreeHash")
lcArchiveSizeInBytes = loJson.StringOf("ArchiveSizeInBytes")
lnCompleted = loJson.BoolOf("Completed")
lcCompletionDate = loJson.StringOf("CompletionDate")
lcCreationDate = loJson.StringOf("CreationDate")
lcInventoryRetrievalParametersEndDate = loJson.StringOf("InventoryRetrievalParameters.EndDate")
lcInventoryRetrievalParametersFormat = loJson.StringOf("InventoryRetrievalParameters.Format")
lcInventoryRetrievalParametersLimit = loJson.StringOf("InventoryRetrievalParameters.Limit")
lcInventoryRetrievalParametersMarker = loJson.StringOf("InventoryRetrievalParameters.Marker")
lcInventoryRetrievalParametersStartDate = loJson.StringOf("InventoryRetrievalParameters.StartDate")
lcInventorySizeInBytes = loJson.StringOf("InventorySizeInBytes")
lcJobDescription = loJson.StringOf("JobDescription")
lcJobId = loJson.StringOf("JobId")
lcJobOutputPath = loJson.StringOf("JobOutputPath")
lcOutputLocation = loJson.StringOf("OutputLocation")
lcRetrievalByteRange = loJson.StringOf("RetrievalByteRange")
lcSHA256TreeHash = loJson.StringOf("SHA256TreeHash")
lcSNSTopic = loJson.StringOf("SNSTopic")
lcSelectParameters = loJson.StringOf("SelectParameters")
lcStatusCode = loJson.StringOf("StatusCode")
lcStatusMessage = loJson.StringOf("StatusMessage")
lcTier = loJson.StringOf("Tier")
lcVaultARN = loJson.StringOf("VaultARN")

RELEASE loRest
RELEASE loAuthAws
RELEASE loSbResponseBody
RELEASE loJson


 

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