通用API参数签名
第一步:
在签名前把将要调用的参数进行JSON压缩,例如:
{"Method":"GetScriptState","SoftGuid":"aaaaaa-bbbbbb-cccccc-ddddddddddd","UID":"1001","TimeStamp":"1671173945","RandomValue":"oaTcdaNrG7AtUQaxqJqOy","BizData":{"ScriptName":"ceshi"}}
第二步:
对压缩过的JSON进行MD5算法,既:MD5(压缩JSON+账户API密钥);这里假如我们的账户API密钥是abcdefg123456789,那么最后需要进行MD5算法的参数就是:
{"Method":"GetScriptState","SoftGuid":"aaaaaa-bbbbbb-cccccc-ddddddddddd","UID":"1001","TimeStamp":"1671173945","RandomValue":"oaTcdaNrG7AtUQaxqJqOy","BizData":{"ScriptName":"ceshi"}}abcdefg123456789
最后MD5后得到的值是:34b43d817e90563d87901b011c0744c6
第三步:
我们把MD5加密后的值再插入到JSON体中,插入到JSON中后最后提交到服务器的JSON也是需要压缩的,例如:
{"Method":"GetScriptState","SoftGuid":"aaaaaa-bbbbbb-cccccc-ddddddddddd","UID":"1001","TimeStamp":"1671173945","RandomValue":"oaTcdaNrG7AtUQaxqJqOy","BizData":{"ScriptName":"ceshi"},"Sign":"34b43d817e90563d87901b011c0744c6"}
这样就签名加密就完成了,,MD5加密算法不需要大小写转换都可以的。您也可以在我们的API测试工具上进行调试!