private string POST(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params Uri address = new Uri(_requestUri + callPrefix + "/" + callName); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = null; wreq.Method = "POST"; wreq.ContentType = "application/x-www-form-urlencoded"; StringBuilder d = new StringBuilder(); d.Append("apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); byte[] bd = UTF8Encoding.UTF8.GetBytes(d.ToString()); wreq.ContentLength = bd.Length; using (Stream ps = wreq.GetRequestStream()) { ps.Write(bd, 0, bd.Length); } return(DoRequest(wreq, parameters.getOutputMode())); }
private string GET(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params StringBuilder uri = new StringBuilder(); uri.Append(_requestUri).Append(callPrefix).Append("/").Append(callName); uri.Append("?apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); Uri address = new Uri(uri.ToString()); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = null; byte[] postData = parameters.GetPostData(); if (postData == null) { wreq.Method = "GET"; } else { wreq.Method = "POST"; using (var ps = wreq.GetRequestStream()) { ps.Write(postData, 0, postData.Length); } } return(DoRequest(wreq, parameters.getOutputMode())); }
private string GET(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params StringBuilder uri = new StringBuilder(); uri.Append(_requestUri).Append(callPrefix).Append("/").Append(callName); uri.Append("?apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); Uri address = new Uri(uri.ToString()); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = WebRequest.DefaultWebProxy; wreq.Method = "GET"; return(DoRequest(wreq, parameters.getOutputMode())); }
private string POST(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params Uri address = new Uri (_requestUri + callPrefix + "/" + callName); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = GlobalProxySelection.GetEmptyWebProxy(); wreq.Method = "POST"; wreq.ContentType = "application/x-www-form-urlencoded"; StringBuilder d = new StringBuilder (); d.Append("apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); byte[] bd = UTF8Encoding.UTF8.GetBytes(d.ToString()); wreq.ContentLength = bd.Length; using (Stream ps = wreq.GetRequestStream()) { ps.Write(bd, 0, bd.Length); } return DoRequest(wreq, parameters.getOutputMode()); }
private string GET(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params StringBuilder uri = new StringBuilder (); uri.Append(_requestUri).Append(callPrefix).Append("/").Append(callName); uri.Append("?apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); Uri address = new Uri (uri.ToString()); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = GlobalProxySelection.GetEmptyWebProxy(); byte[] postData = parameters.GetPostData(); if (postData == null) { wreq.Method = "GET"; } else { wreq.Method = "POST"; using (var ps = wreq.GetRequestStream()) { ps.Write(postData, 0, postData.Length); } } return DoRequest(wreq, parameters.getOutputMode()); }
private string GET(string callName, string callPrefix, AlchemyAPI_BaseParams parameters) { // callMethod, callPrefix, ... params StringBuilder uri = new StringBuilder(); uri.Append(_requestUri).Append(callPrefix).Append("/").Append(callName); uri.Append("?apikey=").Append(_apiKey).Append(parameters.getParameterString()); parameters.resetBaseParams(); Uri address = new Uri(uri.ToString()); HttpWebRequest wreq = WebRequest.Create(address) as HttpWebRequest; wreq.Proxy = GlobalProxySelection.GetEmptyWebProxy(); wreq.Method = "GET"; return DoRequest(wreq, parameters.getOutputMode()); }