News for hackers. Stuff that matters.
Re:Hacker News API by Livven on Tuesday October 07, 2014 @02:34PM (#8423025)
I've been working on a Hacker News client for Windows Phone over the past several weeks and am very close to an initial release, so I feel somewhat ambivalent about this.

On the one hand, of course it's great that HN is finally getting a proper API and also modernizing its markup (which is a mess even if you ignore all the tables – for example, the first paragraph in a comment usually isn't wrapped in <p> tags), but on the other hand this current v0 version is very lacking and impractical for a regular client application.

Since the top stories (limited to 100) and child comments are only available as a list of IDs a client app would have to make a separate HTTP request for every single item, which is obviously not something you'd want to do especially in a mobile environment. Other lists apart from the top stories (new, show, ask, best, active etc.) don't seem to be available at all right now.

Of course this is just the first version, and the documentation promises improvements over time – which I don't doubt at all – but there's no clear indication that the API will be at feature-parity with the current website, even excluding anything that requires authentication, by October 28. So this means that I – and other developers of client apps or unofficial APIs – will probably have to write new scraping code once the new rendering engine (which I assume refers to the website) arrives instead of being able to switch to the new API immediately.

Now I guess I might just be needlessly worried, especially since the blog post explicitly says that the new API "should hopefully making switching your apps fairly painless", but then why not wait until it's actually ready for that before making the announcement? Putting a half-baked API out there a few days/weeks (?) in advance before it's fully fleshed out doesn't seem all that helpful, at least to me.

Re:Hacker News API by kevin on Tuesday October 07, 2014 @02:49PM (#8423131)
Use the Firebase libraries rather than the REST one to efficiently handle requests. I believe it uses a websocket internally. "It does all the work for you and is awesome." to quote Nick.
Re:Hacker News API by Livven on Tuesday October 07, 2014 @04:38PM (#8423877)
Well unfortunately there's no Firebase SDK for Windows Phone/C#/WinRT, and the WebSocket API is undocumented.

EDIT: After having played with the JS SDK a bit I'd like to add that it is indeed incredibly awesome.

Re:Hacker News API by jamest on Tuesday October 07, 2014 @04:53PM (#8423956)
[Firebase founder] There is a Firebase C# SDK on the way. We've had some other things, that we've been working on for the last year, that are shipping in the next few weeks which have taken priority. After that, we'll be shifting focus to new SDKs (they're a little complicated and take a bit of time to build)
Re:Hacker News API by meursault334 on Tuesday October 07, 2014 @10:35PM (#8425053)
I'm really glad to hear this. I have been loving Firebase for the app I'm making but one of the components has to run in C# and talking to Firebase from the C# app was much more painful than the other Firebase portions of the application.
Re:Hacker News API by localhost on Thursday October 09, 2014 @01:48AM (#8430991)
This would be awesome. Right now I'm experimenting using raw HTTP requests and Newtonsoft.Json as the JSON [de]serializer. I presume that you will make your C# SDK a portable class library so we can use it in iOS and Android apps as well via Xamarin?
Re:Hacker News API by Avalaxy on Wednesday October 08, 2014 @04:29AM (#8425853)
"C# SDK" doesn't say much. SilverLight can use C#, WinRT can use C#, .NET can use C#, but that doesn't mean your "C# library" will run everywhere. C# is just the syntax.
Re:Hacker News API by kogir on Tuesday October 07, 2014 @02:55PM (#8423171)
Also, while they don't have a Windows Phone API I previously wrote a COM Windows Scripting API to use it via Chackra from an ASP.Net app.

I think it's even easier now that JS is a supported app language.

Re:Hacker News API by Livven on Tuesday October 07, 2014 @04:36PM (#8423863)
Are you referring to the WebSocket API that the Firebase SDKs use internally? It doesn't seem to be documented anywhere so I guess it's only slightly better than scraping HTML ;)
Re:Hacker News API by kogir on Tuesday October 07, 2014 @05:23PM (#8424094)
I set things up so I could actually run their whole JS SDK and talk to it from C#.
Re:Hacker News API by Livven on Tuesday October 07, 2014 @05:34PM (#8424149)
Thanks for the tip, I actually just figured that out myself a few minutes ago. Should be good enough until a proper SDK arrives.

With access to a Firebase SDK the only major additions the API needs to become a viable replacement for existing read-only client apps would be support for all the other lists apart from top stories (new, show, show new, ask, jobs, best, active) and more than 100 items for each. For apps that need write access I'd suggest keeping the current website on a separate subdomain until that is implemented into the API.

Re:Hacker News API by ptx on Tuesday October 07, 2014 @06:31PM (#8424367)
Didn't they remove support for calling COM APIs (i.e. ActiveX) in Chakra? (At least in IE 10 and later, I think - the versions with proper EcmaScript 5 support.)
Re:Hacker News API by minimaxir on Tuesday October 07, 2014 @02:42PM (#8423076)
> (which is a mess even if you ignore all the tables – for example, the first paragraph in a comment usually isn't wrapped in <p> tags)

Oh, that's in the actual API.

https://hacker-news.firebaseio.com/v0/item/8422922.json?prin...

I strongly hope they add a plain-text field for returned comments.

Re:Hacker News API by dang on Tuesday October 07, 2014 @03:10PM (#8423292)
What you're getting there is how the comment text happens to be stored (and presumably always has been). We've talked about changing that, because it would allow us to do some implementation improvements like... well, I forget just now. Might have had to do with caching. Anyhow, if enough people want it, we'll bump up the priority.
Re:Hacker News API by rcsorensen on Tuesday October 07, 2014 @04:32PM (#8423833)
I would love it. Markdown would be the bee's knees there, if you can reverse it.
Re:Hacker News API by loneranger_11x on Wednesday October 08, 2014 @03:53AM (#8425729)
See if this helps: http://filr.io/channel/hackernews/stream

queryparams: pageSize (no of items to return in one go) before (takes an epoch timestamp and returns results before that timestamp)

this is a stream of HN stories that have made it to the front page, in order of the time that they made it to the frontapge.

Re:Hacker News API by miguelrochefort on Tuesday October 07, 2014 @05:19PM (#8424077)
Or use my Hacker News client for Windows Phone:

http://www.windowsphone.com/en-us/store/app/hacker-news/a527...

Re:Hacker News API by Livven on Tuesday October 07, 2014 @05:53PM (#8424237)
I've tried your app, it's functional but obviously I wasn't satisfied with any of the existing options which is why I wrote my own ;) It should be coming out this week, just a few finishing touches now...
Re:Hacker News API by Avalaxy on Wednesday October 08, 2014 @04:27AM (#8425844)
Great you're here. I'm using this app, but I'm sorry to say this... It's pretty bad.

Here's a list of issues that I encounter very often:

- It often crashes during startup

- There are massive encoding issues, I see question mark symbols pretty often.

- Comments often won't load, without any error message whatsoever.

I uninstalled the app multiple times for these reasons, but unfortunately there isn't anything that's better.

Re:Hacker News API by Livven on Wednesday October 08, 2014 @05:10AM (#8425986)
Would you be willing to beta test my application? It's pretty much finished already and doesn't have any of the issues you listed (in addition to having a, in my opinion, much nicer design), I'd just be looking for some general feedback regarding the discoverability of some features. I could submit a beta today or tomorrow.
Re:Hacker News API by mztan on Thursday October 09, 2014 @02:49AM (#8431130)
I'd like to beta test your app as well! meng.tan [at] gmail. Thanks in advance!
Re:Hacker News API by Avalaxy on Wednesday October 08, 2014 @05:17AM (#8426005)
I would love that. Invite me at leoncullens @ live . nl
Re:Hacker News API by FlyingLawnmower on Wednesday October 08, 2014 @10:42AM (#8427097)
I'd love an invite as well, if possible.
Re:Hacker News API by Livven on Wednesday October 08, 2014 @01:15PM (#8428048)
Sure, just need your Microsoft account email so I can add you to the beta list.