J'ai trouvé alors je partage ...
Imports System
Imports System.Net
Imports System.IO
Imports System.Text
Public Class frmMain
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sURL As String
sURL = "https://api-xxxxxxxxxxxxxxxx"
Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
wrGETURL.Method = "GET"
wrGETURL.ContentType = "application/json"
wrGETURL.Headers.Add("Authorization", "Basic " & Convert.ToBase64String(Encoding.UTF8.GetBytes("login:password")))
'Ci-dessous le point qui m'a bloqué
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
'si on travaille avec un proxy
Dim myProxy As New WebProxy("proxy", 80)
myProxy.BypassProxyOnLocal = True
wrGETURL.Proxy = myProxy
Dim objStream As Stream
Try
objStream = wrGETURL.GetResponse.GetResponseStream()
Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0
'Création d'un fichier texte
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("D:\Texte.txt", True)
Do While Not sLine Is Nothing
i += 1
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
RichTextBox1.Text = sLine
'écriture dans le fichier texte
file.WriteLine(sLine)
End If
Loop
file.Close()
objReader.Close()
objStream.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class