using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Web; using System.Text; using Newtonsoft.Json; namespace App1 { class CallStreamlineAPI { public class Request { public string methodName { get; set; } public Dictionary requestapiparams; } public string callAPI(string methodName, Dictionary Apiinputparams) { string endpoint = "https://web.streamlinevrs.com/api/json"; string token = "89e616d3c8d26f12c3022f8fbae002e4 "; string token_secret = "a9eab8a240ff336fdff6b6bfc722d0127dd05971"; Apiinputparams.Add("token_key", token); Apiinputparams.Add("token_secret", token_secret); Request item = new Request(); item.methodName = methodName; item.requestapiparams = Apiinputparams; string apirequest = JsonConvert.SerializeObject(item); apirequest = apirequest.Replace("requestapiparams", "params"); apirequest = apirequest.Replace("\\", ""); var request = HttpWebRequest.Create(endpoint); var byteData = Encoding.ASCII.GetBytes(apirequest); request.ContentType = "application/json"; request.Method = "POST"; try { using (var stream = request.GetRequestStream()) { stream.Write(byteData, 0, byteData.Length); } var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); return responseString; } catch (WebException) { return null } } } class RunTime { static void Main(string[] args) { var apiinputparams = new Dictionary(); apiinputparams.Add("status_id", "1"); CallStreamlineAPI callStreamlineAPI = new CallStreamlineAPI(); string response = callStreamlineAPI.callAPI("GetPropertyList", apiinputparams); if (response != null) { Console.Write(response); } else { Console.Write("API Error"); } } } }