<p>Michael,</p>

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

<p>Rest-Sign function</p>

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

<p>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 <a href="https://anxbtc.com/api/2/" rel="nofollow">https://anxbtc.com/api/2/</a> that you are calling.</p>

<pre><code>       $post_data_encoded = http_build_query($post_data);
       $msg = $api_path . "\0" . $post_data_encoded;
       $rest_sign = $this-&gt;hmac_512($msg, $api_secret);
</code></pre>

<p></code>

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

<p>Hope this helps,</p>

<p>Evan</p>

CC BY-SA 3.0
2014-04-19T07:28:40.290Z
2014-04-19T07:28:40.290Z
user15344
<p>I've signed up with ANXBTC.com and I'm trying to learn the API (based off MTGOX v2 API): </p>

<p><a href="http://docs.anxv2.apiary.io/" rel="nofollow">http://docs.anxv2.apiary.io/</a></p>

<p>In order to issue commands, there needs to be authentication. </p>

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

<p>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."</p>

<p>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. </p>

<p>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? </p>

<p>If anyone has insight, help is greatly appreciated. </p>

<p>Thanks, Michael</p>

<mtgox><api><authentication>
ANXBTC.com / MTGOX v2 API "Authentication"
redbird_is
# ANXBTC.com / MTGOX v2 API "Authentication"

(Asked by: username_0 on 2014-03-29)

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

**Tags:** mtgox, api, authentication


---

## 1 answers

### Answer by username_1 on 2014-04-19. Score: 1 | Accepted answer

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


---

