Author Topic: VB.NET Prosper API  (Read 2742 times)

ndp

  • Newbie
  • *
  • Posts: 1
    • View Profile
VB.NET Prosper API
« on: August 13, 2014, 09:54:00 AM »
I am writing some software in VB.NET to trade through the API.  I have sample code from Prosper that I have adapted, but it throws an 'unauthorized' error when I request files from the Prosper servers.  THe username and password are correct (and are specifically for API requests).

Prosper doesn't have the resources to explain why their sample code doesn't work.  Does anyone here have ideas?  Here's the code:

sub PROSPER()
        Try
            Dim ListingsURL, listing As String
            ListingsURL = "https://api.prosper.com/api/Listings?$top=3"
            Using client = New System.Net.WebClient()
                client.Credentials = New System.Net.NetworkCredential(txtSettingsUsername.Text, txtSettingsPassword.Text)
                client.UseDefaultCredentials = False
                client.Headers.Add(System.Net.HttpRequestHeader.Accept, "text/csv") 'specify file type to download
                Using reader = New IO.StreamReader(client.OpenRead(ListingsURL)) '===> THIS THROWS A 401/UNAUTHORIZED ERROR
                    reader.ReadLine() 'wipe out the header
                    While (InlineAssignHelper(listing, reader.ReadLine())) IsNot Nothing
                        Console.WriteLine(listing)
                    End While
                End Using
            End Using
        Catch ex As SystemException
            MsgBox(ex.Message)
        End Try
end sub

neals384

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: VB.NET Prosper API
« Reply #1 on: August 14, 2014, 10:37:37 AM »
For sure this is too obvious...somewhere you have set the values for
                txtSettingsUsername.Text and txtSettingsPassword.Text
equal to your username & pw, right?