1.Give the http url of chargify , here the url is domainname.chargify.com then add /webhooks to this url ,/webhooks give the list of all webhooks and format is either json format or xml format
var responseText=string.Empty;
var httpWebRequest = (HttpWebRequest)WebRequest.Create(https://domainname.chargify.com/webhooks.format);
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
2.Pass the apikey and apipassword of chargify
httpWebRequest.Headers.Add("username:" + apikey);
httpWebRequest.Headers.Add("password:" + apipassword);
3.pass basic authentication credentials
httpWebRequest.Credentials = new NetworkCredential(apiKey, apiPassword);
4.Assign the httpWebRequest method ,here the method is GET
httpWebRequest.Method = "GET";
5.Get response text , the response text is either in json format or xml format according to our url
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
responseText = streamReader.ReadToEnd();
}
1 Comment(s)