Tag Info

Hot answers tagged

10

This is a take on a class that has been floating around for a while. I first saw it in kevin's first api. You can use this on all values that are declared as 'unix timestamp', both request and response ///<summary> ///</summary> public static class UnixDateTimeHelper { private const string InvalidUnixEpochErrorMessage = ...


10

Just wanted to let everybody know that I just made a new release of the library here. This release includes tons of bug fixes as well as some breaking changes which shouldn't be a problem if you have been running off the trunk. Also, by popular demand, I added a .Net 3.5 version of the library to this release. The hope here is to eventually have a mono ...


7

You are getting the GZipped stream of the response content. Use DownloadData instead of DownloadString and uncompress the stream before passing it to the JSON deserializer (or whatever you plan to use). Alternatively, you can use the StackOverflow.Net library.


5

Shot in the dark, but I bet "0.9" should be "1.0" in your code. The API version is currently 1.0, 0.9 was a beta version which has long since been deprecated.


5

Use UrlEncode not HtmlEncode. # is legal in HTML, but a restricted character in URLs.


4

All responses from the API are compressed. You can specify the compression scheme (gzip or deflate) in the Accept-Encoding header. If you don't specify, one will be chosen for you. We used to throw up an error when a non-compressed request was received, but a frustrating number of proxies don't pass Accept-Encoding through properly; so instead we silently ...


4

As I learned from George Edison in his comment, the server handles time in UTC format. Just replace your calls to DateTime.Now with DateTime.UtcNow or you can convert any DateTime to UTC format with the ToUniversalTime method. Just make sure not to call ToUniversalTime on the server's time, or it'll get messed up.


3

Are you by any chance using POST? For 1.0 this works. But not for 1.1 (though GET works fine for both 1.0 and 1.1). (I have no idea if it should work though.)


3

With the way the API is currently set up (lots of caching the info page says) is it possible to update the information on a question you've already looked at? I have a list of questions but, as time goes on, the information changes (# of answers, votes, etc) and I would like to be able to update the questions with the new info.


3

You're treating the response as a UTF-8 encoded string. That's bound to fail with binary data like GZip. A quick fix is to use Encoding.GetEncoding("iso-8859-1") instead of UTF8 in StringToByteArray, and also pass this encoding to the StreamReader constructor in FetchURL. That encoding maps bytes to codepoints one-to-one; see this answer on Stack Overflow. ...


2

Event Logging, Caching and Throttling I've just finished implementing these features. Event Logging is a new feature that allows us to debug different methods on the bridge by hooking the events at client.EventLog, and examining the messages logged there. Caching was already present on the previous version of the bridge, but it now supports ...


2

The following is simply my opinion so take it for what is is worth: Whenever I see a LINQ provider built on top of a service, I become very interested to know how and when it is actually executing queries and if the abstraction is really saving me anything. For example the statment: var users = ctx.Sites("api.stackoverflow.com") ...


1

I am aware that the last activity in this thread was more than four years ago, but since it still shows up in Google searches, I would like to point out some errors in the conversion. I have no comments to the JSON.net related part of the converter, since that is what I searched for. But the conversion from and to UNIX timestamps is wrong. A UNIX timestamp ...


1

You have to create a post describing your application, and edit it into your application's registration. Basically, the first arrow needs a value; and you can set it when you edit (with the second arrow). Click "Manage your applications" in the homepage sidebar of Stack Apps to get to your application list. We require this so that: we always have a ...


1

In a nutshell and don't know ask me how to write this in C#: That first "500 error" page is normal. You must display that to the user and the user must approve. When the user approves, the page will redirect to a page (nominally stackexchange.com/oauth/login_success) with the access_token in the URL parameters. For example: ...


1

string post_data = "client_id={0}&client_secret={1}&code={2}&redirect_uri={3}"; post_data = string.Format(post_data, code, clientId, redirect_url, apiSecret); Shouldn't that be string post_data = "client_id={0}&client_secret={1}&code={2}&redirect_uri={3}"; post_data = string.Format(post_data, clientId, apiSecret, code, ...


1

In the StackyClient.GetQuestions function, for the tags parameter, will you get questions with any of the tags in the array, or questions that have all of the tags in the array? Also I don't see really any documentation except for the page with a few examples, which don't explain what exactly the parameters do and stuff. If anyone could link me to a ...


1

Thanks for this super library! I've used it for my Overflow 7 app. (See also the Overflow 7 video.) I've put a few detailed comments on your Stacky codeplex discussion site. I hope they help. Thanks again, Stuart


1

I have not tried Stacky in Azure so I can't really comment from experience on that. I can say that the problem doesn't appear to be the assembly not being there. If, for example, the newtonsoft assembly was missing you would be getting an exception like: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, ...


1

So would Soapi.js get something like this? If so, sure. I would love to see something like that. I don't (and probably never will) use C#, so my opinion extends only to JavaScript.



Only top voted, non community-wiki answers of a minimum length are eligible