1. Request method
Request method: POST
Data format: multipart/form-data
2. Encryption rules
API requests are highly likely to be tampered with while being sent over the Internet. In order to ensure that the request has not been changed, we will require the user to add a signature to each request to verify that the parameter or parameter value has not changed during transmission.
Using the get order interface as an example:
How to sign the request parameters, the parameters submitted by the user (except "sign" must include a signature.
First, the string to be signed is required to be sorted in ascending alphabetical order according to the parameter name.
For example: Sign the following parameters
api_key=376892265asdad5d12726d8bbfbd8912b3&nonce=309127×tamp=1510235730
and then splice on your api_secret (only add the value, don't include the variable name api_secret, don't need to write '&')
Example: api_secret=aQmE8U7bxj16KdJcSd3yX8F8Sakd8aO6LopnHXh27d4kWyb28PxcaTvGrajLDvAw
Spliced signature string: api_key=376892265asdad5d12726d8bbfbd8912b3&nonce=309127×tamp=1510235730aQmE8U7bxj16KdJcSd3yX8F8Sakd8aO6LopnHXh27d4kWyb28PxcaTvGrajLDvANote that "sign" is a mandatory parameter for signature, do not url encode before calling md5, and do not send api_secret through the interface to prevent exposure
Finally, use the 32-bit md5 algorithm to perform a signature operation on the final string to be signed, so as to obtain the signature result string (the string is assigned to the parameter "sign").
3. Interface request basic parameters
parameter | Required | type | Notes |
---|---|---|---|
api_key | Yes | string | The api_key requested by the user |
nonce | Yes | int | Interface random number, only six-digit random number |
timestamp | Yes | int | Request interface second-level timestamp, only accepts requests within ten seconds (based on Hong Kong time) |
sign | Yes | string | sign |