Getting Cities list in the form of DataSet using Zomato API

     HttpWebRequest webRequest =
                    WebRequest.Create("https://api.zomato.com/v1/cities.xml")
                            as
HttpWebRequest;
    HttpWebResponse webResponse = null;
    webRequest.Headers.Add("X-Zomato-API-Key", "KeyValue"); 
    //you can get KeyValue by registering with Zomato.
    webRequest.Method = "GET";
    webResponse = (HttpWebResponse)webRequest.GetResponse();
    if (webResponse.StatusCode == HttpStatusCode.OK)
    {
         StreamReader responseReader = new
                            StreamReader
(webResponse.GetResponseStream());
         string responseData = responseReader.ReadToEnd();
         XmlDocument doc = new XmlDocument();
         doc.LoadXml(responseData);
         XmlNodeReader xmlReader = new XmlNodeReader(doc);
         DataSet ds = new DataSet();
         ds.ReadXml(xmlReader);
         return ds;
    }
Ebook Download
View all
Learn
View all