{"header"{"appid":"bpmnew_fanwei","sign":"C033162E86E4CADE80C7EB44D68A5AD2","sign_type":"md5","url":"https://oa.mioffice.cn/api/bpm/xm/app/show/todoflow","method":""},"body":"{\"pageSize\":\"30\",\"userName\":\"liumingtao\",\"title\":\"\",\"currentPage\":\"1\",\"procDefIdPrefix\":\"65\"}"}
步骤1:复制代码到 pre-request script中
var x5 = {
run: function(appid,appkey) {
if (typeof appid == "undefined") {
appid = pm.environment.get("appid");
}
if (typeof appkey == "undefined") {
appkey = pm.environment.get("appkey");
}
var self = this;
var tmpArr = {};
var reqData = request.data;
if (_.isObject(reqData)) {
var keys = _.sortBy(_.keys(reqData));
_(keys).forEach(function(key) {
tmpArr[key] = reqData[key];
}).value()
}
delete tmpArr.data;
var json_body = JSON.stringify(tmpArr).replace(/\\\\u/g, '\\u');
var sign = CryptoJS.MD5(appid + json_body + appkey, {asString: true}).toString().toUpperCase();
var data = {
header :{
appid : appid,
sign : sign
},
body : json_body
};
data = JSON.stringify(data).replace(/\\\\u/g, '\\u');
pm.globals.set("data", CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data)));
}
}
x5.run();
步骤2:添加环境变量
步骤3:输入请求信息
步骤4:选择环境变量