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
(SQL Server) 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
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- This example assumes the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @http int -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int -- 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 DECLARE @crypt int -- Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @crypt OUT DECLARE @apiPath nvarchar(4000) SELECT @apiPath = 'v2/auth/r/info/user' DECLARE @apiKey nvarchar(4000) SELECT @apiKey = 'MY_API_KEY' DECLARE @apiSecret nvarchar(4000) SELECT @apiSecret = 'MY_API_SECRET' DECLARE @dt int -- Use "Chilkat_9_5_0.CkDateTime" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.CkDateTime', @dt OUT EXEC sp_OAMethod @dt, 'SetFromCurrentSystemTime', @success OUT DECLARE @sbNonce int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbNonce OUT EXEC sp_OAMethod @dt, 'GetAsUnixTimeStr', @sTmp0 OUT, 0 EXEC sp_OAMethod @sbNonce, 'Append', @success OUT, @sTmp0 EXEC sp_OAMethod @sbNonce, 'Append', @success OUT, '000' DECLARE @nonce nvarchar(4000) EXEC sp_OAMethod @sbNonce, 'GetAsString', @nonce OUT -- This particular request has an empty body. DECLARE @body nvarchar(4000) SELECT @body = '' DECLARE @sbSignature int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbSignature OUT EXEC sp_OAMethod @sbSignature, 'Append', @success OUT, '/api/' EXEC sp_OAMethod @sbSignature, 'Append', @success OUT, @apiPath EXEC sp_OAMethod @sbSignature, 'Append', @success OUT, @nonce EXEC sp_OAMethod @sbSignature, 'Append', @success OUT, @body EXEC sp_OASetProperty @crypt, 'EncodingMode', 'hex_lower' EXEC sp_OASetProperty @crypt, 'HashAlgorithm', 'sha384' EXEC sp_OASetProperty @crypt, 'MacAlgorithm', 'hmac' EXEC sp_OAMethod @crypt, 'SetMacKeyString', @success OUT, @apiSecret DECLARE @sig nvarchar(4000) EXEC sp_OAMethod @sbSignature, 'GetAsString', @sTmp0 OUT EXEC sp_OAMethod @crypt, 'MacStringENC', @sig OUT, @sTmp0 EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'bfx-apikey', @apiKey EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'bfx-signature', @sig EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'bfx-nonce', @nonce DECLARE @resp int EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'POST', 'https://api.bitfinex.com/v2/auth/r/info/user' EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT IF @iTmp0 = 0 BEGIN EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @crypt EXEC @hr = sp_OADestroy @dt EXEC @hr = sp_OADestroy @sbNonce EXEC @hr = sp_OADestroy @sbSignature RETURN END PRINT 'Response body:' EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT PRINT @sTmp0 -- Sample response body: -- [1234567,"joe@example.com","joe_trader",1527691729000,0,null,null,"Central Time (US & Canada)"] EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @crypt EXEC @hr = sp_OADestroy @dt EXEC @hr = sp_OADestroy @sbNonce EXEC @hr = sp_OADestroy @sbSignature END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.