Example Code | VESTEL B2B Support Portal

Example Code

Add Customer POST Function

 public bool GuestIn(CustomerCheckIn cCheckIn)
{
//Implementation URL and data
string sturlurl = string.Format("http://localhost/htmlhoteltv_v1.1.15/api/hbys/customer/add");
string postData = JsonConvert.SerializeObject(cCheckIn);
var httpWebRequest = (HttpWebRequest)WebRequest.Create(sturlurl);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(postData);
streamWriter.Flush();
streamWriter.Close();
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
return true;
}