Sample code for 30+ languages & platforms
AutoIt

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 AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oHttp = ObjCreate("Chilkat.Http")

; 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

$oCrypt = ObjCreate("Chilkat.Crypt2")

Local $sApiPath = "v2/auth/r/info/user"
Local $sApiKey = "MY_API_KEY"
Local $sApiSecret = "MY_API_SECRET"

$oDt = ObjCreate("Chilkat.CkDateTime")
$oDt.SetFromCurrentSystemTime()

$oSbNonce = ObjCreate("Chilkat.StringBuilder")
$oSbNonce.Append($oDt.GetAsUnixTimeStr(False))
$oSbNonce.Append("000")
Local $sNonce = $oSbNonce.GetAsString()

; This particular request has an empty body.
Local $sBody = ""

$oSbSignature = ObjCreate("Chilkat.StringBuilder")
$oSbSignature.Append("/api/")
$oSbSignature.Append($sApiPath)
$oSbSignature.Append($sNonce)
$oSbSignature.Append($sBody)

$oCrypt.EncodingMode = "hex_lower"
$oCrypt.HashAlgorithm = "sha384"
$oCrypt.MacAlgorithm = "hmac"
$oCrypt.SetMacKeyString($sApiSecret)

Local $sig = $oCrypt.MacStringENC($oSbSignature.GetAsString())

$oHttp.SetRequestHeader "bfx-apikey",$sApiKey
$oHttp.SetRequestHeader "bfx-signature",$sig
$oHttp.SetRequestHeader "bfx-nonce",$sNonce

$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpNoBody("POST","https://api.bitfinex.com/v2/auth/r/info/user",$oResp)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Response body:" & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

; Sample response body:

; [1234567,"joe@example.com","joe_trader",1527691729000,0,null,null,"Central Time (US & Canada)"]