PowerBuilder
PowerBuilder
Bitfinex v2 REST User Info
See more Bitfinex v2 REST Examples
Retrieve the user ID, email, username and timezone setting for the account associated with the API key used.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Crypt
string ls_ApiPath
string ls_ApiKey
string ls_ApiSecret
oleobject loo_Dt
oleobject loo_SbNonce
string ls_Nonce
string ls_Body
oleobject loo_SbSignature
string ls_Sig
oleobject loo_Resp
li_Success = 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Implements the following CURL command:
// curl -X POST -H "bfx-nonce: nonce" \
// -H "bfx-apikey: apiKey" \
// -H "bfx-signature: sig" \
// https://api.bitfinex.com/v2/auth/r/info/user
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
ls_ApiPath = "v2/auth/r/info/user"
ls_ApiKey = "MY_API_KEY"
ls_ApiSecret = "MY_API_SECRET"
loo_Dt = create oleobject
li_rc = loo_Dt.ConnectToNewObject("Chilkat.CkDateTime")
loo_Dt.SetFromCurrentSystemTime()
loo_SbNonce = create oleobject
li_rc = loo_SbNonce.ConnectToNewObject("Chilkat.StringBuilder")
loo_SbNonce.Append(loo_Dt.GetAsUnixTimeStr(0))
loo_SbNonce.Append("000")
ls_Nonce = loo_SbNonce.GetAsString()
// This particular request has an empty body.
ls_Body = ""
loo_SbSignature = create oleobject
li_rc = loo_SbSignature.ConnectToNewObject("Chilkat.StringBuilder")
loo_SbSignature.Append("/api/")
loo_SbSignature.Append(ls_ApiPath)
loo_SbSignature.Append(ls_Nonce)
loo_SbSignature.Append(ls_Body)
loo_Crypt.EncodingMode = "hex_lower"
loo_Crypt.HashAlgorithm = "sha384"
loo_Crypt.MacAlgorithm = "hmac"
loo_Crypt.SetMacKeyString(ls_ApiSecret)
ls_Sig = loo_Crypt.MacStringENC(loo_SbSignature.GetAsString())
loo_Http.SetRequestHeader("bfx-apikey",ls_ApiKey)
loo_Http.SetRequestHeader("bfx-signature",ls_Sig)
loo_Http.SetRequestHeader("bfx-nonce",ls_Nonce)
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
li_Success = loo_Http.HttpNoBody("POST","https://api.bitfinex.com/v2/auth/r/info/user",loo_Resp)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Crypt
destroy loo_Dt
destroy loo_SbNonce
destroy loo_SbSignature
destroy loo_Resp
return
end if
Write-Debug "Response body:"
Write-Debug loo_Resp.BodyStr
// Sample response body:
// [1234567,"joe@example.com","joe_trader",1527691729000,0,null,null,"Central Time (US & Canada)"]
destroy loo_Http
destroy loo_Crypt
destroy loo_Dt
destroy loo_SbNonce
destroy loo_SbSignature
destroy loo_Resp