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) ETrade v1 List Accounts

List ETrade accounts using the ETrade v1 API.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loHttp
LOCAL loJson
LOCAL lnSuccess
LOCAL lcRespStr
LOCAL lnStatusCode
LOCAL loXml
LOCAL i
LOCAL lnCount_i
LOCAL lcTagPath
LOCAL lnAccountId
LOCAL lcAccountIdKey
LOCAL lcAccountMode
LOCAL lcAccountDesc
LOCAL lcAccountName
LOCAL lcAccountType
LOCAL lcInstitutionType
LOCAL lcAccountStatus
LOCAL lnClosedDate

* 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.Http')
loHttp = CreateObject('Chilkat.Http')

loHttp.OAuth1 = 1
loHttp.OAuthVerifier = ""
loHttp.OAuthConsumerKey = "ETRADE_CONSUMER_KEY"
loHttp.OAuthConsumerSecret = "ETRADE_CONSUMER_SECRET"

* Load the access token previously obtained via the OAuth1 3-Legged Authorization examples Step1 and Step2.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
lnSuccess = loJson.LoadFile("qa_data/tokens/etrade.json")
IF (lnSuccess <> 1) THEN
    ? "Failed to load OAuth1 token"
    RELEASE loHttp
    RELEASE loJson
    CANCEL
ENDIF

loHttp.OAuthToken = loJson.StringOf("oauth_token")
loHttp.OAuthTokenSecret = loJson.StringOf("oauth_token_secret")

* See the ETrade v1 API documentation HERE.

lcRespStr = loHttp.QuickGetStr("https://apisb.etrade.com/v1/accounts/list")
IF (loHttp.LastMethodSuccess <> 1) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    CANCEL
ENDIF

* A 200 status code indicates success.
lnStatusCode = loHttp.LastStatus
? "statusCode = " + STR(lnStatusCode)

* Use the following online tool to generate parsing code from sample XML: 
* Generate Parsing Code from XML

* A sample XML response is shown below...

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Xml')
loXml = CreateObject('Chilkat.Xml')
loXml.LoadXml(lcRespStr)

i = 0
lnCount_i = loXml.NumChildrenHavingTag("Accounts|Account")
DO WHILE i < lnCount_i
    loXml.I = i
    lnAccountId = loXml.GetChildIntValue("Accounts|Account[i]|accountId")
    lcAccountIdKey = loXml.GetChildContent("Accounts|Account[i]|accountIdKey")
    lcAccountMode = loXml.GetChildContent("Accounts|Account[i]|accountMode")
    lcAccountDesc = loXml.GetChildContent("Accounts|Account[i]|accountDesc")
    lcAccountName = loXml.GetChildContent("Accounts|Account[i]|accountName")
    lcAccountType = loXml.GetChildContent("Accounts|Account[i]|accountType")
    lcInstitutionType = loXml.GetChildContent("Accounts|Account[i]|institutionType")
    lcAccountStatus = loXml.GetChildContent("Accounts|Account[i]|accountStatus")
    lnClosedDate = loXml.GetChildIntValue("Accounts|Account[i]|closedDate")
    i = i + 1
ENDDO

* <?xml version="1.0" encoding="UTF-8"?>
* <AccountListResponse>
*    <Accounts>
*       <Account>
*          <accountId>84010429</accountId>
*          <accountIdKey>JIdOIAcSpwR1Jva7RQBraQ</accountIdKey>
*          <accountMode>MARGIN</accountMode>
*          <accountDesc>INDIVIDUAL</accountDesc>
*          <accountName>Individual Brokerage</accountName>
*          <accountType>INDIVIDUAL</accountType>
*          <institutionType>BROKERAGE</institutionType>
*          <accountStatus>ACTIVE</accountStatus>
*          <closedDate>0</closedDate>
*       </Account>
*       <Account>
*          <accountId>84010430</accountId>
*          <accountIdKey>JAAOIAcSpwR1Jva7RQBraQ</accountIdKey>
*          <accountMode>MARGIN</accountMode>
*          <accountDesc>INDIVIDUAL</accountDesc>
*          <accountName>Individual Brokerage</accountName>
*          <accountType>INDIVIDUAL</accountType>
*          <institutionType>BROKERAGE</institutionType>
*          <accountStatus>ACTIVE</accountStatus>
*          <closedDate>0</closedDate>
*       </Account>
*    </Accounts>
* </AccountListResponse>

RELEASE loHttp
RELEASE loJson
RELEASE loXml


 

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