![]() |
Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
(PureBasic) Bitfinex v2 REST User InfoRetrieve the user ID, email, username and timezone setting for the account associated with the API key used. For more information, see https://docs.bitfinex.com/reference#rest-auth-info-user
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkDateTime.pb" IncludeFile "CkCrypt2.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i ; 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 crypt.i = CkCrypt2::ckCreate() If crypt.i = 0 Debug "Failed to create object." ProcedureReturn EndIf apiPath.s = "v2/auth/r/info/user" apiKey.s = "MY_API_KEY" apiSecret.s = "MY_API_SECRET" dt.i = CkDateTime::ckCreate() If dt.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkDateTime::ckSetFromCurrentSystemTime(dt) sbNonce.i = CkStringBuilder::ckCreate() If sbNonce.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkStringBuilder::ckAppend(sbNonce,CkDateTime::ckGetAsUnixTimeStr(dt,0)) CkStringBuilder::ckAppend(sbNonce,"000") nonce.s = CkStringBuilder::ckGetAsString(sbNonce) ; This particular request has an empty body. body.s = "" sbSignature.i = CkStringBuilder::ckCreate() If sbSignature.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkStringBuilder::ckAppend(sbSignature,"/api/") CkStringBuilder::ckAppend(sbSignature,apiPath) CkStringBuilder::ckAppend(sbSignature,nonce) CkStringBuilder::ckAppend(sbSignature,body) CkCrypt2::setCkEncodingMode(crypt, "hex_lower") CkCrypt2::setCkHashAlgorithm(crypt, "sha384") CkCrypt2::setCkMacAlgorithm(crypt, "hmac") CkCrypt2::ckSetMacKeyString(crypt,apiSecret) sig.s = CkCrypt2::ckMacStringENC(crypt,CkStringBuilder::ckGetAsString(sbSignature)) CkHttp::ckSetRequestHeader(http,"bfx-apikey",apiKey) CkHttp::ckSetRequestHeader(http,"bfx-signature",sig) CkHttp::ckSetRequestHeader(http,"bfx-nonce",nonce) resp.i = CkHttp::ckQuickRequest(http,"POST","https://api.bitfinex.com/v2/auth/r/info/user") If CkHttp::ckLastMethodSuccess(http) = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkCrypt2::ckDispose(crypt) CkDateTime::ckDispose(dt) CkStringBuilder::ckDispose(sbNonce) CkStringBuilder::ckDispose(sbSignature) ProcedureReturn EndIf Debug "Response body:" Debug CkHttpResponse::ckBodyStr(resp) ; Sample response body: ; [1234567,"joe@example.com","joe_trader",1527691729000,0,null,null,"Central Time (US & Canada)"] CkHttp::ckDispose(http) CkCrypt2::ckDispose(crypt) CkDateTime::ckDispose(dt) CkStringBuilder::ckDispose(sbNonce) CkStringBuilder::ckDispose(sbSignature) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.