I am accessing Company House Api for searching Company Details. For accesiing API I have created a webservice in C#
public string GetCompanyDetailsByNumber(string Email, string password, string strCompanyNumber)
{
string theURL = "https://api.companieshouse.gov.uk";
var url = theURL + "/search/companies?q= '" + strCompanyNumber.Trim() + "' ";
HttpWebRequest client = (HttpWebRequest)WebRequest.Create(new Uri(url));
string results = string.Empty;
client.Method = "GET";
client.ContentType = "application/json";
client.Host = "api.companieshouse.gov.uk";
client.Headers.Add("Authorization", "Basic MY apI kEY");
client.Accept = "text/plain,*/*; q=0.01";
HttpWebResponse response;
using (response = client.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
results = reader.ReadToEnd();
// DataTable tester = (DataTable)JsonConvert.DeserializeObject( results, (typeof(DataTable)));
}
return results;
}
Above returns data when its search by Name but do not reutrn data when search by Company Number
Kindly guide