After trying around, thx to the nice documentation of Yobit, i finally managed to get a usefull error message back. It gives me the error: invalid sign.
Im using the code below. I already tried the solution of this post here:
https://stackoverflow.com/questions/48717976/yobit-api-invalid-sign-cAnyone an idea?
var client = new HttpClient();
var request = new HttpRequestMessage();
request.Method = HttpMethod.Post;
request.RequestUri = new Uri("https://yobit.net/tapi/");
var nonce = (int)Math.Round(DateTime.Now.Subtract(new DateTime(2018, 1, 1)).TotalSeconds);
string parameters = String.Format("method=getInfo&nonce=" + nonce);
request.Content = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded");
request.Content.Headers.Add("Key", public_key);
using (var hmac = new HMACSHA512(Convert.FromBase64String(secret_key)))
{
byte[] signHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(parameters));
string sign = BitConverter.ToString(signHash).ToLower().Replace("-", string.Empty);
request.Content.Headers.Add("Sign", sign);
}
using (HttpResponseMessage response = client.SendAsync(request).Result)
{
using (HttpContent content = response.Content)
{
var bytecontent = content.ReadAsByteArrayAsync().Result;
var json = Encoding.UTF8.GetString(bytecontent);
Console.WriteLine(json);
}
}