December 2019
Intermediate to advanced
494 pages
11h 41m
English
While performing a GET request in your browser is nice, you're probably going to use this to call functions from your own code, and probably using the POST method. Luckily, this isn't very difficult to do. Open up Visual Studio, create a new .NET Core console app, and put the following code in the Program.cs file:
using System;using System.Net.Http;using System.Text;namespace ConsoleApp1{ class Program { static void Main(string[] args) { using (var client = new HttpClient()) { string url = "[your URL]"; var content = new StringContent("{\"name\": \"[your name]\"}", Encoding.UTF8, "application/json"); client.PostAsync(url, content).ContinueWith(async t => { var result = await t.Result.Content.ReadAsStringAsync(); ...