VB.NET

Here below is an example of using the ClicRDV API in VB.NET. Here we use the HTTP Basic authentication, and the XML format.

Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Xml

Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim str As String

Try

  ' Credentials
  Dim apikey = "xxxxxx"
  Dim user = "[email protected]"
  Dim pwd = "myPwd"

  Dim baseUrl = "https://sandbox.clicrdv.com/api/v1"
  Dim url = baseUrl+"/groups/:group_id/calendars?format=xml&results=10&apikey=" + apikey

  ' Building the request
  request = DirectCast(WebRequest.Create(url), HttpWebRequest)

  ' Basic Authentification
  request.PreAuthenticate = True
  request.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested
  Dim encodedHdr = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(user + ":" + pwd))
  request.Headers.Add("Authorization", "Basic " + encodedHdr)

  ' Reading response
  response = DirectCast(request.GetResponse(), HttpWebResponse)
  reader = New StreamReader(response.GetResponseStream())
  str = reader.ReadToEnd()

  ' Parsing XML and printing the name of each result
  Using xmlreader As XmlReader = xmlreader.Create(New StringReader(str))

    While xmlreader.ReadToFollowing("name")
      Console.WriteLine(xmlreader.ReadElementContentAsString())
    End While
  End Using

Catch ex As Exception
  Console.WriteLine(ex.Message)
Finally
  If Not response Is Nothing Then
    response.Close()
  End If
End Try