![]() |
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
(SQL Server) Bitfinex v2 REST User InfoRetrieve the user ID, email, username and timezone setting for the account associated with the API key used. Note: This example requires Chilkat v11.0.0 or greater. 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 -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) DECLARE @success int SELECT @success = 0 -- This example assumes the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @http int EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- 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 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 EXEC @hr = sp_OACreate 'Chilkat.CkDateTime', @dt OUT EXEC sp_OAMethod @dt, 'SetFromCurrentSystemTime', @success OUT DECLARE @sbNonce int 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 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 @hr = sp_OACreate 'Chilkat.HttpResponse', @resp OUT EXEC sp_OAMethod @http, 'HttpNoBody', @success OUT, 'POST', 'https://api.bitfinex.com/v2/auth/r/info/user', @resp IF @success = 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 EXEC @hr = sp_OADestroy @resp 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 EXEC @hr = sp_OADestroy @resp END GO |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.