-1

I am in small trouble I need to hit the UK Companies House API from https://developer.companieshouse.gov.uk/api/.

On its website it has a nice example to do it using CURL.Since I am programming in C# MVC and need to implement the Company Search functionality that will fetch data using this API.

Kovid Purohit
  • 258
  • 1
  • 4
  • 15

1 Answers1

0

According to this Stack Overflow post. the C# equivalent of the Curl example (https://api.companieshouse.gov.uk/search/companies) could look like this:

using System.Net;
using System.IO;

string url = "GET https://api.companieshouse.gov.uk/search/companies";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Credentials = // here you have to set your authentication data
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
ˈvɔlə
  • 9,204
  • 10
  • 63
  • 89