Link Search Menu Expand Document

Signature Generation

The signature is formed as MD5 when joining the request body and the string.

Assuming secret = '123123' and you need to send a request to {"exampleRequest": "hello world"}. Then the signature line will be as follows:

➜  ~ echo -n '{"exampleRequest": "hello world"}123123' | md5sum
3fca36637c4b2294e0f0aaa2a815ebd9  -

The generated request can be sent as follows:

➜  ~ curl -s \
    -H 'Sign:3fca36637c4b2294e0f0aaa2a815ebd9' \
    -H "Content-Type: application/json" \
    --request POST --max-time 30 \
    --data '{"exampleRequest": "hello world"}' $endpointUrl

To test or load game lists from CI systems, you can use a script as follows:

#!/bin/bash
REQ=$@
if hash md5 2>/dev/null; then
  MD5=md5
else
  MD5="md5sum"
fi
SIGN=`echo -n $REQ$secret | $MD5 | awk '{ print $1 }'`

echo running POST request to host $endpointUrl with sign = $SIGN and request = $REQ

curl -v \
  -H "Sign:$SIGN" \
  -H "Content-Type: application/json" \
  --request POST --max-time 30 \
        --data "$REQ" $endpointUrl

Calling the script:

endpointUrl="https://127.0.0.1" secret="123123" bash ./execute-request.sh '{"exampleRequest": "hello world"}'