title: How do I operate around Stack Exchange API in .NET Core MVC
body: <p>How can do I work with StackOverflow API and HTTP request it?</p>
  <p>This is my problem: I want to get first 1000 tags from Stack Exchange API, see their popularity and usage.</p>
  <p>This is what I've done so far:</p>
  <ol>
  <li><p>Created an ASP.NET MVC project</p>
  </li>
  <li><p>Added HTTP Client in <code>Startup.cs</code> file:</p>
  <pre><code> public void ConfigureServices(IServiceCollection services)
   {
       services.AddControllersWithViews();
       services.AddHttpClient(&quot;stackoverflow&quot;, s =&gt;
       {
           s.BaseAddress = new Uri(&quot;https://api.stackexchange.com/2.3&quot;);
           s.DefaultRequestHeaders.Add(&quot;client_id&quot;, &quot;1&quot;);
           s.DefaultRequestHeaders.Add(&quot;site&quot;, &quot;stackoverflow&quot;);
           s.DefaultRequestHeaders.Add(&quot;redirect_uri&quot;, &quot;https://api.stackexchange.com/2.3/tags?&quot;);
       });
   }
  </code></pre>
  </li>
  <li><p>Created classes <code>Tags</code> and interface <code>ITagsRepository</code>:</p>
  <pre><code> public class Tags
   {
       public int Id { get; set; }
       public int Popularity { get; set; }
       public decimal Usage { get; set; }
   }
  
   public class TagsRepository : ITagsRepository
   {
       public Tags GetTag(int id)
       {
           // put logic in here
       }
   }
  </code></pre>
  </li>
  <li><p>I also have added a <code>TagsController</code> in <code>HomeController.cs</code>:</p>
  <pre><code> public class TagsController : Tags
   {
       private ITagsRepository _tagsRepository;
  
       public TagsController(ITagsRepository tagsRepository)
       {
           _tagsRepository = tagsRepository;
       }
  
       public IActionResult GetTag(int id)
       {
           Tags tag = _tagsRepository.GetTag(id);
           return View(tag);
       }
   }
  </code></pre>
  </li>
  </ol>
  <p>My question is: how do I make my code run in <code>index.cshtml</code> and how do I make http requests that are customisable from client side?</p>