Signature
Signature Algorithm
- From the request parameters, exclude
sign
and all parameters with null or empty values. Then, sort the remaining parameters lexicographically.
Lexicographical Definition: In English dictionaries, words are arranged in order of the first letter (i.e., in the sequence a, b, c… z). If the first letter is the same, compare the second, third, and subsequent letters. If by the end the two words are of different lengths (e.g., “sigh” and “sight”), place the shorter one first.
-
After sorting, concatenate the parameters in the format “
key1value1key2value2...
”. -
Prepend the
API Key
to the string obtained from step 2. -
Convert the string from step 3 into an
md5
hash, in lowercase, to get thesign
. Include thissign
in the request parameters.
Signature Example
step 1 Assuming the API Key
is:
The request parameters excluding the ‘sign’ field are:
step 2 Sort and combine the non-empty
key-value pairs in dictionary order:
step 3 Concatenate the API key
to the string from the previous step:
step 4 Calculate the MD5 hash of the resulting string. The computed ‘sign’ value is:
final step Add the computed ‘sign’ value to the original request parameters: