Jane Jane - 14 days ago 6x
JSON Question

Invalid API prameters

I created object call API when I set only

as parameter of method program run without any errors . When I'd set parameter like that ("swapList",$t) I get
{"error":407,"errorMsg":"Invalid value: currency","time":1476023664,"limit":{"used":5,"allowed":600,"expires":1476024000}}
.I tried alot of arrays set there but results was the same. Here is API documentation https://github.com/bitmarket-net/api

Here is my code

class API
public function bitmarket_api($method, $params = array())

$params["method"] = $method;
$params["tonce"] = time();

$post = http_build_query($params, "", "&");
$sign = hash_hmac("sha512", $post, $secret);
$headers = array(
"API-Key: " . $key,
"API-Hash: ". $sign,

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, "https://www.bitmarket.pl/api2/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$ret = curl_exec($curl);
if ($ret === false)
echo $ret;

$z =new API;



You pass the parameters array without key name.

Try with:

$t['currency'] = 'BTC';