ANXBTC.com / MTGOX v2 API "Authentication"

1

I've signed up with ANXBTC.com and I'm trying to learn the API (based off MTGOX v2 API):

http://docs.anxv2.apiary.io/

In order to issue commands, there needs to be authentication.

I have a "Rest-Key", but I have no idea how to generate/find a "Rest-Sign".

On the link above, it says that "Rest-Sign is an HMAC hash constructed from your API secret, your API method path, your post data, and uses the SHA-512 algorithm."

Also on the above link, there is sample code (PHP, python etc) which can be tested - however it needs both the Rest-Key and Rest-Sign.

Part 2: Are these APIs meant to be run solely off a personal computer, or can it be used online? Eventually I want to try and create a website form where I can show the current exchange rate, as well as place orders. Is that possible?

If anyone has insight, help is greatly appreciated.

Thanks, Michael

redbird_is

Posted 2014-03-29T02:48:08.260

Reputation: 13

Answers

1

Michael,

To generate the Rest-Sign header, use the following code (example in PHP):

Rest-Sign function

 function hmac_512($msg, $secret)
        {
        $secret = base64_decode($secret);
        $result = hash_hmac('sha512', $msg, $secret, true);
        return base64_encode($result);
        }

Rest-Sign inputs $post_data should be an array with a nonce and any relevant API post data, and $api_path should be the portion of the API after https://anxbtc.com/api/2/ that you are calling.

       $post_data_encoded = http_build_query($post_data);
       $msg = $api_path . "\0" . $post_data_encoded;
       $rest_sign = $this->hmac_512($msg, $api_secret);

Regarding your second question, you can run this API from your personal computer or a server.

Hope this helps,

Evan

user15344

Posted 2014-03-29T02:48:08.260

Reputation: 34