Bitcoin Forum
May 22, 2024, 05:10:29 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: hilfe bei bitfinex api.... kleines problem...  (Read 2598 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
Wolke (OP)
Legendary
*
Offline Offline

Activity: 966
Merit: 1000


View Profile
July 07, 2014, 02:18:32 PM
Last edit: August 13, 2014, 03:18:57 PM by Wolke
 #1

hey...

hänge hier an einem kleinen problem mit der bitfinex api....

Bei der Methode: GET, mit api_path = "/v1/symbols", Funktioniert es.

GET -> läuft

POST -> leider nicht, gibt nur fehler 400 ->
Fehler: Der Remoteserver hat einen Fehler zurückgegeben: (400) Ungültige Anforderung.

würde mich über tipps oder hilfe sehr freuen...

Code:
VB.NET-Quellcode

    ​
    Public Shared api_url As String = "https://api.bitfinex.com/"
    Public Shared api_key As String = "CodeCodeCode"
    Public Shared api_secret As String ="CodeCodeCode"
    Public Shared api_path As String = "/v1/symbols"
    'Public Shared api_path As String = "/v1/account_infos"
    Public Function check_balance()
    Dim payLoadobject As New PayLoad()
    Dim MySerializer As JavaScriptSerializer = New JavaScriptSerializer()
    Dim payloadJson As String = MySerializer.Serialize(payLoadobject)
    Dim payload As String = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(payloadJson))
    Dim encoding As New System.Text.ASCIIEncoding()
    Dim getmessageBytes As Byte() = encoding.GetBytes(payload)
    Dim secretByte As Byte() = encoding.GetBytes(api_secret)
    Dim gethmacsha384 As New HMACSHA384(secretByte)
    Dim hashmessage As Byte() = gethmacsha384.ComputeHash(getmessageBytes)
    Dim finalString As New StringBuilder()
    For i As Integer = 0 To hashmessage.Length - 1
    finalString.Append(hashmessage(i).ToString("X2"))
    Next
    Dim SIGNATURE As String = finalString.ToString()
    Dim request As HttpWebRequest
    Dim nurl As String = api_url + api_path
    Dim address As Uri = New Uri(nurl)
    request = DirectCast(WebRequest.Create(address), HttpWebRequest)
    request.Accept = True
    request.Method = "GET" 'POST or GET
    request.Headers("X-BFX-APIKEY") = api_key
    request.Headers("X-BFX-PAYLOAD") = payload
    request.Headers("X-BFX-SIGNATURE") = SIGNATURE
    request.AllowAutoRedirect = True
    request.AllowWriteStreamBuffering = True
    request.KeepAlive = True
    Dim response As HttpWebResponse = Nothing
    Dim reader As StreamReader = Nothing
    Dim result As String = Nothing
    Try
    response = DirectCast(request.GetResponse(), HttpWebResponse)
    reader = New StreamReader(response.GetResponseStream())
    result = reader.ReadToEnd()
    Catch ex As Exception
    Return ex.Message.ToString()
    Finally
    If Not response Is Nothing Then response.Close()
    End Try
    Return result
    End Function
    Public Class coptions
    Public hostname As String = "https://api.bitfinex.com/"
    Public port As String = "443"
    Public path As String
    Public method As String = "GET" 'POST OR GET
    End Class
    Public Class PayLoad
    Public request As String = api_path
    Public nonce As String = Convert.ToInt64((DateTime.Now - New DateTime(1970, 1, 1)).TotalMilliseconds)
    Public options As New coptions
    End Class


Wolke (OP)
Legendary
*
Offline Offline

Activity: 966
Merit: 1000


View Profile
July 09, 2014, 07:04:43 PM
 #2

push

Wolke (OP)
Legendary
*
Offline Offline

Activity: 966
Merit: 1000


View Profile
August 13, 2014, 03:18:05 PM
 #3

push

daybyter
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
August 13, 2014, 09:34:54 PM
 #4

Vermutlich wird Dir bei vb.net kaum einer helfen können. Würde eher mal ein Log posten, während er einen Request versucht, oder so.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!