I want to get my Binance account info by calling API via SQL Server. But I can't figure it out how sent API key with suitable format. Is it possible? How should I sent API key with get request?
Error: {"code":-2014,"msg":"API-key format invalid."}
Here is my SQL below;
DECLARE @Object AS INT;
DECLARE @ResponseT AS VARCHAR(max);
DECLARE @Response AS TABLE(Json_Table NVARCHAR(MAX))
DECLARE @Signature NVARCHAR(255) = 'XXXXXXXXXXXXXXXXXXXXXX'
DECLARE @Timestamp_Value NVARCHAR(255) = '163818122343'
DECLARE @Url NVARCHAR(1000) = 'https://api.binance.com/api/v3/account?'+'timestamp='+@Timestamp_Value+'&signature='+@Signature
DECLARE @Api_Key varchar(max) = '[{
"Name": "X-MBX-APIKEY",
"Value" :"YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
}]';
EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
EXEC sp_OAMethod @Object, 'open', NULL, 'get',
@Url,
'false'
EXEC sp_OAMethod @Object, 'setRequestHeader', NULL, 'Content-Type', 'application/json';
EXEC sp_OAMethod @Object, 'send', null, @Api_Key
EXEC sp_OAMethod @Object, 'responseText', @ResponseT OUTPUT
INSERT INTO @Response (Json_Table)
EXEC sp_OAGetProperty @Object, 'responseText'
SELECT * FROM @Response
EXEC sp_OADestroy @Object