public class HIKOpenAPI
{
public static string HttpPost(string url,string api, string body, string ak, string sk) {
Log.Logs("user", Log.LogType.Info, $"Send|| url(https://blog.csdn.net/api).{url + api}");
Log.Logs("user", Log.LogType.Info, $"Send|| body.{body}");
var headers = new Dictionary<string, string> { { "Accept", "*/*" }, { "Content-Type", "application/json" } };
var request = new Request(Method.POST_STRING, url, api, ak, sk, 10000) {
Headers = headers,
SignHeaderPrefixList = null,
Querys = null,
StringBody = body
};
var result= DoPoststring(request.Host, request.Path, request.Timeout, request.Headers, request.Querys, request.StringBody, request.SignHeaderPrefixList, request.AppKey, request.AppSecret, false);
Log.Logs("user", Log.LogType.Info, $"Recv|| result.{result}");
return result;
}
//Post请求方法
public static string DoPoststring(string host, string path, int connectTimeout, Dictionary<string, string> headers,
Dictionary<string, string> querys, string body, List<string> signHeaderPrefixList, string appKey,
string appSecret, bool autoDown)
{
try
{
headers = initialBasicHeader("POST", path, headers, querys, null, signHeaderPrefixList, appKey,
appSecret);
ServicePointManager.ServerCertificateValidationCallback =
RemoteCertificateValidate;
//验证服务器证书回调自动验证
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 |
SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(initUrl(host, path, querys));
request.KeepAlive = false;
request.ProtocolVersion = HttpVersion.Version10;
//设置HTTP协议的并发连接数
//ServicePointManager.DefaultConnectionLimit = 512;
//关闭重定向
request.AllowAutoRedirect = false;
request.Method = "POST";
request.Timeout = connectTimeout;
string accept = headers["Accept"];
request.Accept = accept;
string contentType = headers["Content-Type"];
request.ContentType = contentType;
foreach (string headerKey in headers.Keys)
{
if (headerKey.Contains("x-ca-"))
{
request.Headers.Add(headerKey + ":" +
(string.IsNullOrWhiteSpace(headers[h
海康威视-综合安防管理平台(iSecure Center)签名规则C#
于 2022-07-07 10:35:20 首次发布
海康开放平台致力于打造能力开放体系和两个生态圈,Hikvision AI Cloud开放平台是核心。它基于海康威视视频及物联网核心技术积累,融合AI、大数据、云计算等技术,为合作伙伴提供二次开发及创新平台。

4万+

被折叠的 条评论
为什么被折叠?



