Working .Net Implementation for calling API

I have been mining the internet for a few days, trying to get an implementation that works with .Net calling into the API. I have gotten to the point of being able to login and get a token, but when I use that token to make a YQL call, I get back either an invalid_signature or 401 error. Can someone help me out? I know it might be a longshot since these forums aren't used much. I have tried all the examples on here, as well as most I have found using Google. Has anyone got this to work using .Net?

4 Replies
  • same here. just fine with all the token requests, followed the documentation to a key ... and cant get the actual information request to work.
  • I am hoping a developer reads these forms, but most of the examples I have seen are old to say the least.
  • I tried posting some code examples for you, but it's not doing anything when I hit the button.
  •  I was having the same problem as you and it was something to do with my signature.

    This code works for me.
    GetApiData(New Uri("http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/stat_categories"), aToken, "C:\Users\Shane\Desktop\categories.xml")

    &nbsp;&nbsp;&nbsp;&nbsp;</br>&nbsp;&nbsp;&nbsp;&nbsp;GetApiData(New Uri(&quot;http://fantasysports.yahooapis.com/fantasy/v2/game/nfl/stat_categories&quot;), aToken, &quot;C:&#92;categories.xml&quot;)</br></br>&nbsp;&nbsp;&nbsp;&nbsp;Public Sub GetApiData(u As Uri, aToken As AccessToken, filename As String)</br></br>      Dim strNormalizedUrl, strNormalizedRequestParameters, strSignature, strNonce, strTimeStamp, strResponse As String</br>      Dim xmlDoc As Xml.XmlDocument</br></br>      strNonce = Me.GenerateNonce</br>      strTimeStamp = Me.GenerateTimeStamp</br></br></br>      strSignature = Me.GenerateSignature(u, ConsumerKey, ConsumerSecret, aToken.oAuthToken, aToken.oAuthTokenSecret, &quot;GET&quot;, strTimeStamp, strNonce, strNormalizedUrl, strNormalizedRequestParameters)</br></br>      strNormalizedRequestParameters &amp;= &quot;&oauth_signature=&quot; + UrlEncode(strSignature)</br></br>      strResponse = DoWebRequest(strNormalizedUrl &amp; &quot;?&quot; &amp; strNormalizedRequestParameters)</br></br>      xmlDoc = New Xml.XmlDocument</br></br>      xmlDoc.LoadXml(strResponse)</br></br>      File.Delete(filename)</br></br>      xmlDoc.Save(filename)</br></br>    End Sub</br></br>    Private Function DoWebRequest(url As String) As String</br>      Dim strResponse As String = &quot;&quot;</br>      Dim request As HttpWebRequest</br>      Dim response As WebResponse</br>      Dim reader As StreamReader</br>      Try</br></br>        request = DirectCast(WebRequest.Create(url), HttpWebRequest)</br>        request.Method = &quot;GET&quot;</br></br>        response = request.GetResponse</br></br>        reader = New StreamReader(response.GetResponseStream)</br></br>        strResponse = reader.ReadToEnd()</br></br>      Catch ex As Exception</br></br>      End Try</br></br>      Return strResponse</br>    End Function</br></code>

Recent Posts

in Fantasy Sports API