private static Dictionary <string, string> newParamsMap(Dictionary <string, string> paramsMap, string apiName, string version, string accessKey, string securityKey) { Dictionary <string, string> newParamsMap = new Dictionary <string, string>(); if (paramsMap != null) { foreach (KeyValuePair <string, string> pair in paramsMap) { if (!newParamsMap.ContainsKey(pair.Key)) { newParamsMap[pair.Key] = pair.Value; } } } newParamsMap.Add("_api_access_key", accessKey); newParamsMap.Add("_api_name", apiName); DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0, DateTimeKind.Utc); TimeSpan span = (TimeSpan)(DateTime.UtcNow - time); newParamsMap.Add("_api_timestamp", ((long)span.TotalMilliseconds).ToString()); newParamsMap.Add("_api_version", version); newParamsMap.Add("_api_signature", SignUtil.sign(newParamsMap, securityKey)); return(newParamsMap); }
private static Dictionary <string, string> httpHeadParametersSet(string apiName, string version, string accessKey, string securityKey, Dictionary <string, string> requestdata) { Dictionary <string, string> paramsDic = new Dictionary <string, string>(); paramsDic.Add("_api_name", apiName); paramsDic.Add("_api_version", version); DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0, DateTimeKind.Utc); TimeSpan span = (TimeSpan)(DateTime.UtcNow - time); paramsDic.Add("_api_timestamp", ((long)span.TotalMilliseconds).ToString()); paramsDic.Add("_api_access_key", accessKey); paramsDic.Add("_api_signature", SignUtil.sign(requestdata, securityKey)); return(paramsDic); }