Press F4 to import the .NET references.
Run LINQPad in "VB Program" mode.
Run the following VB code (replacing what is in curly brackets with your info):
Sub Main Dim wc As New System.Net.WebClient() Dim strZenDeskUsername As String = "{my email address}" Dim strZenDeskPassword As String = "{my password}" Dim strZenDeskAPIURL As String = "https://{my subdomain}.zendesk.com/api/v1/users.xml" Dim request As System.Net.HttpWebRequest = DirectCast(System.Net.HttpWebRequest.Create(strZenDeskAPIURL), System.Net.HttpWebRequest) request.ContentType = "application/json" request.Credentials = New System.Net.NetworkCredential(strZenDeskUsername, strZenDeskPassword) request.Headers("Authorization") = strZenDeskUsername & ":" & strZenDeskPassword request.PreAuthenticate = True request.Accept = "application/json, application/xml, text/json, text/x-json, text/javascript, text/xml" request.ContentLength = 0 Dim resp As System.Net.HttpWebResponse = DirectCast(request.GetResponse(), System.Net.HttpWebResponse) Dim reader As New System.IO.StreamReader(resp.GetResponseStream()) Dim tmp As String = reader.ReadToEnd() Console.Writeline(tmp.ToString) 'Dim stream As New StringReader(tmp) 'Dim ds As New DataSet() 'ds.ReadXml(stream) 'Dim dt As DataTable = ds.Tables("user") End Sub
No comments:
Post a Comment