Exemplo n.º 1
0
        public HttpWebRequest GetRequestforFileUpload(Endpoint p, String boundary, String fileId, UploadFileRequest requestData)
        {
            String url = this.url + p.Path;

            HttpWebRequest wrReq;

            wrReq         = (HttpWebRequest)WebRequest.Create(url);
            wrReq.Timeout = Timeout.Infinite;
            wrReq.Headers.Add(apiKeyHeadervalue, apiKey);

            DateTime now       = DateTime.UtcNow;
            String   dateStr   = now.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss") + "+0000";
            String   signature = CreateSignature(privateKey, apiKey, p.Path, dateStr, ConvertToJSON(requestData));

            wrReq.Headers.Add(apiSignatureHeadervalue, signature);
            wrReq.Headers.Add(apiTimestampHeadervalue, dateStr);

            wrReq.Method      = p.Method.ToString();
            wrReq.ContentType = p.ContentType + "; boundary=" + boundary;

            String userAgent = generateUserAgent();

            wrReq.UserAgent = userAgent;

            if (proxy != null)
            {
                wrReq.Proxy = proxy;
            }

            return(wrReq);
        }
Exemplo n.º 2
0
 public HttpWebRequest GetRequestforFileUpload(Endpoint p, String boundary, UploadFileRequest requestData)
 {
     return(GetRequestforFileUpload(p, boundary, null, requestData));
 }