Post() public method

Executes an HTTP POST command and retrives the information. This function will automatically include a "source" parameter if the "Source" property is set.
public Post ( string url, string userName, string password, string contentType, string data ) : string
url string The URL to perform the POST operation
userName string The username to use with the request
password string The password to use with the request
contentType string
data string The data to post
return string
コード例 #1
0
ファイル: Analytics.cs プロジェクト: geobabbler/GeoIQ4Net
        public AnalyticsResponse Union(int overlayid1, int overlayid2, MergeOptions merge)
        {
            AnalyticsResponse retval = null;
            try
            {
                GeoComWebClient request = new GeoComWebClient();
                string mergestring = Enum.GetName(typeof(MergeOptions), merge);
                string url = String.Format(_unionTemplate, EndpointURI, overlayid1, overlayid2, mergestring);
                setCredentials(request);

                //validateFileType(files);
                string response = request.Post(url, UserName, Password, "application/json", "");
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(GeoIQ.Net.Data.AnalyticsResponse));
                byte[] bytes = Encoding.ASCII.GetBytes(response);
                System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);
                stream.Position = 0;
                GeoIQ.Net.Data.AnalyticsResponse result = (GeoIQ.Net.Data.AnalyticsResponse)serializer.ReadObject(stream);

                retval = result;
            }
            catch (Exception ex)
            {
                this.LastError = ex;
                retval = null;
            }
            return retval;
        }
コード例 #2
0
ファイル: Maps.cs プロジェクト: geoiq/GeoIQ4Net
 public string createMap(string options)
 {
     try
     {
         GeoComWebClient request = new GeoComWebClient();
         string url = String.Format("{0}/maps.json", EndpointURI);
         var result = request.Post(url, UserName, Password, "application/x-www-form-urlencoded", options);
         return result;
     }
     catch
     {
         return "";
     }
 }