Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C++) 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
#include <CkHttpW.h> #include <CkCrypt2W.h> #include <CkDateTimeW.h> #include <CkStringBuilderW.h> #include <CkHttpResponseW.h> void ChilkatSample(void) { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttpW http; bool success; // 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 CkCrypt2W crypt; const wchar_t *apiPath = L"v2/auth/r/info/user"; const wchar_t *apiKey = L"MY_API_KEY"; const wchar_t *apiSecret = L"MY_API_SECRET"; CkDateTimeW dt; dt.SetFromCurrentSystemTime(); CkStringBuilderW sbNonce; sbNonce.Append(dt.getAsUnixTimeStr(false)); sbNonce.Append(L"000"); const wchar_t *nonce = sbNonce.getAsString(); // This particular request has an empty body. const wchar_t *body = L""; CkStringBuilderW sbSignature; sbSignature.Append(L"/api/"); sbSignature.Append(apiPath); sbSignature.Append(nonce); sbSignature.Append(body); crypt.put_EncodingMode(L"hex_lower"); crypt.put_HashAlgorithm(L"sha384"); crypt.put_MacAlgorithm(L"hmac"); crypt.SetMacKeyString(apiSecret); const wchar_t *sig = crypt.macStringENC(sbSignature.getAsString()); http.SetRequestHeader(L"bfx-apikey",apiKey); http.SetRequestHeader(L"bfx-signature",sig); http.SetRequestHeader(L"bfx-nonce",nonce); CkHttpResponseW *resp = http.QuickRequest(L"POST",L"https://api.bitfinex.com/v2/auth/r/info/user"); if (http.get_LastMethodSuccess() == false) { wprintf(L"%s\n",http.lastErrorText()); return; } wprintf(L"Response body:\n"); wprintf(L"%s\n",resp->bodyStr()); // Sample response body: // [1234567,"joe@example.com","joe_trader",1527691729000,0,null,null,"Central Time (US & Canada)"] } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.