Some REST endpoints allow performing sensitive operations such as placing orders or requesting a
digital asset withdrawal. These private endpoints can therefore be called only through encrypted requests and an authentication string (authent) must be included in each such request. authent is computed from the following inputs:
postData is a "&" concatenation in the form <argument>=<value> and is specific to each REST endpoint.
|Example||To operate the endpoint orderbook you choose the argument symbol with value
fi_xbtusd_180615. postData is then given by symbol=fi_xbtusd_180615.
nonce is a continuously incrementing integer parameter. A good nonce is your system time in
milliseconds (in string format). Our system tolerates nonces that are out of order for a brief period of time. Nonce is not required.
Many authentication issues are related with incorrect nonce. A new pair of API keys will automatically reset the nonce and resolve these issues.
endpointPath This is the URL extension of the endpoint.
The api_secret is obtained as described in the previous section.
Based on these inputs, authent needs to be computed as follows:
- Concatenate postData + nonce + endpointPath
- Hash the result of step 1 with the SHA-256 algorithm
- Base64-decode your api_secret
- Use the result of step 3 to hash the result of the step 2 with the HMAC-SHA-512 algorithm
- Base64-encode the result of step 4
The following shows an implementation of authent in Java. For full working examples in different programming languages, see Section Additional Resources.
public static String getAuthent(String postData, String nonce, String endpointPath, String secretKeyBase64)