来自Bitstamp.net的空响应

时间:2017-09-08 17:55:18

标签: rest api http

我正在尝试使用Bitstamp的私有api来查询我帐户的余额。我相信我发布了正确的数据,因为没有返回错误,但Bitstamp的答案总是空的

*   Trying 107.154.249.133...
* Connected to www.bitstamp.net (107.154.249.133) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection:         
ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* NPN, negotiated HTTP1.1
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*    subject: OU=Domain Control Validated; CN=*.bitstamp.net
*    start date: Apr  8 14:11:39 2015 GMT
*    expire date: Apr  8 15:48:13 2018 GMT
*    subjectAltName: www.bitstamp.net matched
*    issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.;     
OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate     
Authority - G2
*    SSL certificate verify ok.
> POST /api/v2/balance HTTP/1.1
Host: www.bitstamp.net
User-Agent: Bitstamp C++ API Client
Accept: */*
Content-Length: 134
Content-Type: application/x-www-form-urlencoded

* upload completely sent off: 134 out of 134 bytes
< HTTP/1.1 301 MOVED PERMANENTLY
< Access-Control-Allow-Headers: x-requested-with, Content-Type, origin, accept, cache-control
< Access-Control-Allow-Methods: POST, GET
< Access-Control-Allow-Origin: *
< Content-Language: en
< Content-Type: text/html; charset=utf-8
< Date: Fri, 08 Sep 2017 17:46:41 GMT
< Location: http://www.bitstamp.net/api/v2/balance/
< Server: Apache
< Strict-Transport-Security: max-age=63072000; includeSubDomains
< Vary: Accept-Language
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
< Connection: keep-alive
< Set-Cookie: visid_incap_99025=wHhR5uPzT92ReB9XbeNToIHXslkAAAAAQUIPAAAAAAAbNQJEog5ZojcqdOv0dFhd; expires=Sat, 08 Sep 2018 10:32:13 GMT; path=/; Domain=.bitstamp.net
< Set-Cookie: nlbi_99025=VyBXXwUOsQHckThX8F1n9AAAAABOW3tLZ0nUHyp47yinIimv; path=/; Domain=.bitstamp.net
< Set-Cookie: incap_ses_569_99025=04PeXe3KGFAAVw//8n7lB4HXslkAAAAA09BkGnsaiskl2dkFxzhFXQ==; path=/; Domain=.bitstamp.net
< X-Iinfo: 9-15073063-15060114 PNNN RT(1504892800858 31) q(0 0 0 -1) r(2 2)     U6
< X-CDN: Incapsula
< 
* Connection #0 to host www.bitstamp.net left intact
result: 0
response: 
terminate called after throwing an instance of 'std::runtime_error'
  what():  Bitstamp response doesn't contain result data

有什么想法吗? 非常感谢提前!

1 个答案:

答案 0 :(得分:4)

最初我的平衡路径为/balance,但在更改为/balance/之后,它的工作效率达到了200,并且有效负载为200。

因此,请注意尾随反斜杠

,而不是http://www.bitstamp.net/api/v2/balance使用http://www.bitstamp.net/api/v2/balance/