Studying this SO question ( Authenticated Java Jersey REST call to Bitstamp ), I see that OP had a similar issue. Unfortunately, I can't make the call work in my own implementation: I tried sending key
, nonce
and signature
both via query-parameters as well as json formatted in the request's body. I logged headers and content, so in those two cases, these are the resulting logs:
// send in body
---> POST https://www.bitstamp.net/api/v2/balance/ HTTP/1.1
Accept: application/json;charset=UTF-8
Content-Type: application/json;charset=UTF-8
Content-Length: 140
{"key":"12345678901234567890123456789012","nonce":1234567890,"signature":"1234567890123456789012345678901234567890123456789012345678901234"}
---> END HTTP (140-byte body)
<--- HTTP/1.1 403 Authentication Failed (49ms)
{"status": "error", "reason": "Missing key, signature and nonce parameters.", "code": "API0000"}
<--- END HTTP (96-byte body)
// send as query-parameters
---> POST https://www.bitstamp.net/api/v2/balance/?key=12345678901234567890123456789012&signature=1234567890123456789012345678901234567890123456789012345678901234&nonce=1234567890 HTTP/1.1
Accept: application/json;charset=UTF-8
Content-Type: application/x-www-form-urlencoded
---> END HTTP (0-byte body)
<--- HTTP/1.1 403 Authentication Failed (45ms)
{"status": "error", "reason": "Missing key, signature and nonce parameters.", "code": "API0000"}
<--- END HTTP (96-byte body)
What am I doing wrong? What does bitstamp mean when it states
For a successful authentication you need to provide your API key, a signature and a nonce parameter. (https://www.bitstamp.net/api/)
I use Feign as REST client. The two methods look like this:
@PostMapping(value = "api/v2/balance/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
ResponseEntity<Map<String, Object>> getAccountBalanceQuery(@RequestParam("key") String key,
@RequestParam("signature") String signature,
@RequestParam("nonce") Integer nonce);
@PostMapping(value = "api/v2/balance/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
ResponseEntity<Map<String, Object>> getAccountBalanceBody(@RequestBody BitstampAuth body);
Thanks!