Documentation > CMS Template API Library > Util > PutHttp(String,PutHttpParams)
PutHttp
Sends a PUT request to the provided URL. Use the PostHttpParams object to set the Put Data as well as optional values for timeout, headers, and content-type.
public CrownPeak.CMSAPI.PutHttpResponse PutHttp(String,PutHttpParams)
Returns
A PutHttpResponse object which contains the response text as well as various meta data about the PUT request. A Status Code of -900 is returned if a connection to the server could not be established.
Parameters
| Name | Description | Type |
|---|---|---|
| url | The URL. | System.String |
| postHttpParams | The HTTP params. | CrownPeak.CMSAPI.PutHttpParams |
Code Example
C#
Sample:
string url = "http://www.crownpeak.com";
PutHttpParams postHttpParams = new PutHttpParams();
putHttpParams.TimeOut = 20;
putHttpParams.AddHeader("Accept-Encoding: gzip,deflate");
putHttpParams.ContentType = "Content-Type: text/xml";
PutHttpResponse response = Util.PutHttp(url, putHttpParams);
if(response.StatusCode >= 200 && response.StatusCode < 300)
{
Out.WriteLine(response.ResponseText);
}