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) 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.

loHttp = CreateObject('Chilkat_9_5_0.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.
loJson = CreateObject('Chilkat_9_5_0.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...

loXml = CreateObject('Chilkat_9_5_0.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-2019 Chilkat Software, Inc. All Rights Reserved.