Created
March 10, 2019 01:44
-
-
Save AnthonyDGreen/21f1467613baa3540ee7a4c8d0c2f2be to your computer and use it in GitHub Desktop.
JsonDemo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Net.Http | |
Imports Newtonsoft.Json.Linq | |
Module RestDemo | |
Async Function RunAsync() As Task | |
Dim client As New HttpClient With {.BaseAddress = New Uri("https://api.github.com")} | |
#Region " Initialize HttpClient headers " | |
With client.DefaultRequestHeaders | |
.UserAgent.Add("JsonDemo", "0.1") | |
.Accept.Add("application/json") | |
.Authorization.Set("Token", My.Settings.AccessToken) | |
End With | |
#End Region | |
Dim gist = | |
{ | |
"description": My.Application.Info.AssemblyName, | |
"public": true, | |
"files": { | |
"RestDemo.vb": { | |
"content": IO.File.ReadAllText("..\..\RestDemo.vb") | |
} | |
} | |
} | |
Dim response = Await client.PostJsonAsync("/gists", gist) | |
Console.WriteLine(response) | |
End Function | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment