Bitcoin Forum
September 13, 2025, 05:12:08 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Bter API problem  (Read 3675 times)
marcus03 (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 21, 2014, 06:45:30 PM
 #1

Hi!

I' am implementing charting in my application for NXT prices and trying to retrieve the NXT trades at Bter through:

http://bter.com/api/1/trade/nxt_btc/3603233

Two out of three times I get

'<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><iframe src="/_Incapsula_Resource?CWUDNSAI=9&incident_id=104000570172938530-2564557266307515286&edet=12&cinfo=2e3bde81c753866a08000000" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 104000570172938530-2564557266307515286</iframe></html>'

which shows a captcha input page.

Is the Bter API not for bots? Which humans read json data?

Is there a way around this?

Thanks!
Marcus
pmconrad
Full Member
***
Offline Offline

Activity: 149
Merit: 102


View Profile WWW
January 21, 2014, 09:32:57 PM
 #2

The Bter trade API has been broken for over a month now.

xchrix
Hero Member
*****
Offline Offline

Activity: 905
Merit: 1001



View Profile
January 22, 2014, 12:11:14 PM
 #3

i am trying to get the funds trough the private API. its also broken
data.bter.com is completely wrong
whats going on with bter? Smiley
marcus03 (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 22, 2014, 12:52:44 PM
 #4

i am trying to get the funds trough the private API. its also broken
data.bter.com is completely wrong
whats going on with bter? Smiley

Use bter.com without the "data.". Still, kind of buggy.
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
January 22, 2014, 08:37:04 PM
 #5

For the last two days all private API query has wrong result. ( Incapsula incident ID: ... ) I use same program, same IP, same method. I tried change API keys and tried use other user account and other IP too. I got the same result always. I wrote letter to support of bter in two days ago. I asked what i do ? And of course this letter remained unanswered.  Bter API died. :-(
marcus03 (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 22, 2014, 08:38:45 PM
 #6

For the last two days all private API query has wrong result. ( Incapsula incident ID: ... ) I use same program, same IP, same method. I tried change API keys and tried use other user account and other IP too. I got the same result always. I wrote letter to support of bter in two days ago. I asked what i do ? And of course this letter remained unanswered.  Bter API died. :-(


Brute force kind of works... Repeat request up to ten times until you have a result which has no "<HEAD>". Not nice play, but ya know...
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
January 22, 2014, 08:57:50 PM
 #7

Not work this method. :-( Simple API queries like history ( bter.com/api/1/trade/btc_cny ) usually working good but private api queries always have same wrong result. I tried up to 20 times but not good. Getfunds query example working for you ? ( bter.com/api/1/private/getfunds )
jsCoin
Newbie
*
Offline Offline

Activity: 32
Merit: 0


View Profile
January 23, 2014, 11:13:12 PM
 #8

Glad its not just me.  I just started implementing Bter and public calls work just fine but when testing private calls I was racking my brain trying to find what was wrong with my code.  Doesn't look good with support not responding though.  Has Bter entered zombie mode?
xchrix
Hero Member
*****
Offline Offline

Activity: 905
Merit: 1001



View Profile
January 24, 2014, 07:38:40 AM
 #9

what shall we do about this? writing emails to bter support is a bad idea because they never answer Cheesy
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
January 24, 2014, 08:29:12 AM
 #10

Glad its not just me.  I just started implementing Bter and public calls work just fine but when testing private calls I was racking my brain trying to find what was wrong with my code.  Doesn't look good with support not responding though.  Has Bter entered zombie mode?

Don't trying to find bugs with your code. Your code are probably correct. Example code of bter is good. That code worked me lot of previous days. Now not. ( public api calls work, private api cals don't work )
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
January 24, 2014, 12:47:13 PM
 #11

Bter fixed problem. All API ( private too ) queries work again successfully. Now good everything.  I hope will work for a long time.
Int32
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
January 28, 2014, 07:00:40 PM
 #12

wow... incomprehensible! Cheesy
it's working for me too... with the same code Smiley

but one question:
i will place a doge_btc order with a rate of "0.00000268" ... webrequest is okay, but in my account i see only 6 decimal places: "0.000003"?

don't know what to do :/
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
January 29, 2014, 09:31:11 AM
 #13

wow... incomprehensible! Cheesy
it's working for me too... with the same code Smiley

but one question:
i will place a doge_btc order with a rate of "0.00000268" ... webrequest is okay, but in my account i see only 6 decimal places: "0.000003"?

don't know what to do :/

Always rounded values ​​displayed on the website, but the calculations use the floated value.
jondecker76
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
February 02, 2014, 06:19:04 PM
 #14

I found a few other problems with the Bter API today

1) in the json result, a result of true is as expected ("result":true), but false results have quotes around the "false", making the json_decode treat it as a string ("response":"false").  This makes for undesired behavior, as the string "false" can evaluate as true.

2) The order_id returned by  https://bter.com/api/1/private/placeorder is incorrect.  I just tried this a few times today, and the order_id returned is not even close to the actual order ID which gets assigned (off by over 7,000,000).

I have emailed Bter support about it, but of course I don't expect a response from such a shoddy operation.

RollerBot Advanced Trading Platform
https://bitcointalk.org/index.php?topic=447727.0
BTC Donations for development: 1H36oTJsi3adFh68wwzz95tPP2xoAoTmhC
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
February 06, 2014, 02:39:38 PM
 #15

I found a few other problems with the Bter API today

1) in the json result, a result of true is as expected ("result":true), but false results have quotes around the "false", making the json_decode treat it as a string ("response":"false").  This makes for undesired behavior, as the string "false" can evaluate as true.

2) The order_id returned by  https://bter.com/api/1/private/placeorder is incorrect.  I just tried this a few times today, and the order_id returned is not even close to the actual order ID which gets assigned (off by over 7,000,000).

I have emailed Bter support about it, but of course I don't expect a response from such a shoddy operation.

Bter API "documentation":
Notice: The returned order_id is meaningless, please use this API https://bter.com/api/1/private/orderlist to obtain all your open order IDs
305115334
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
February 17, 2014, 02:10:22 AM
 #16

I use java to access the Restful bter api, the public info can be reached. Once tried private api, it returns "..".
I dont know what is wrong. Maybe sign and key are not matched.
Could u give me a privelege authentication example written in java? Thanks!
borzalom
Full Member
***
Offline Offline

Activity: 169
Merit: 100



View Profile
February 19, 2014, 08:36:37 PM
 #17

I use java to access the Restful bter api, the public info can be reached. Once tried private api, it returns "..".
I dont know what is wrong. Maybe sign and key are not matched.
Could u give me a privelege authentication example written in java? Thanks!

You must sign the post data. ( see php example code of bter api documentation )
PHP example code work good. Try it your sign keys.

php:
$sign = hash_hmac('sha512', $post_data, $secret);

java:
            byte[] bytesKey = ....
            final SecretKeySpec secretKey = new SecretKeySpec( bytesKey, "HmacSHA512" );
            mac = Mac.getInstance( "HmacSHA512" );
            mac.init( secretKey );
            final byte[] macData = mac.doFinal( datas.getBytes( ) );
            byte[] hex = new Hex( ).encode( macData );
            result = new String( hex, "ISO-8859-1" );
305115334
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
February 20, 2014, 05:07:09 AM
 #18

I have signed the post data.
URL getUrl = new URL("https://bter.com/api/1/private/orderlist");
      HttpURLConnection aConnection = (HttpURLConnection) getUrl
            .openConnection();
      Map<String, String> data = new HashMap<String, String>();
      // data.put("dad", "fff");
      // data.put("order_id", "fff");
      data.put("nonce", String.valueOf(System.currentTimeMillis()));
      String postdata = httpBuildQuery(data);
      String sign = generateHMAC(postdata);
      aConnection.setRequestMethod("POST");
      //aConnection.setDoOutput(true);
      aConnection.setRequestProperty("Key",
            "*************");
      aConnection.setRequestProperty("Sign", sign.replaceAll("\n", ""));
      
      aConnection.connect();
      BufferedReader reader = new BufferedReader(new InputStreamReader(
            aConnection.getInputStream(), "utf-8"));

I dont know what is wrong.
   private static String httpBuildQuery(Map<String, String> data)
         throws UnsupportedEncodingException {
         String result = new String();
           for (String hashkey : data.keySet()) {
               if (result.length() > 0) result += '&';
               try {
                   result += URLEncoder.encode(hashkey, "UTF-8") + "="
                           + URLEncoder.encode(data.get(hashkey), "UTF-8");
               } catch (Exception ex) {
                   // Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
               }
           }
           return result;
   }
305115334
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
February 20, 2014, 05:14:56 AM
 #19

private static String generateHMAC(String datas) {

      // final Charset asciiCs = Charset.forName( "utf-8" );
      Mac mac;
      String result = "";
      try {

         SecretKeySpec secretKey;

         try {
            secretKey = new SecretKeySpec(
                  (new BASE64Decoder()).decodeBuffer("**************************************"),
                  "HmacSHA512");
            mac = Mac.getInstance("HmacSHA512");
            mac.init(secretKey);
            final byte[] macData = mac.doFinal(datas.getBytes());
            result = (new BASE64Encoder()).encode(macData);
            
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }

         

      } catch (final NoSuchAlgorithmException e) {

      } catch (final InvalidKeyException e) {

      }
      return result;

   }
305115334
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
February 20, 2014, 05:24:07 AM
 #20

{"result":"false","message":"Error: invalid data"}  This is the above return result.
Pages: [1] 2 »  All
  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!