New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON API for third-party apps / Lobsters iPhone App #42

Closed
rhysforyou opened this Issue Dec 2, 2012 · 27 comments

Comments

Projects
None yet
2 participants
@rhysforyou
Contributor

rhysforyou commented Dec 2, 2012

I'd absolutely love a JSON API so people can build apps on top of Lobste.rs. I've been wanting to build an iPhone client for the site for a while but the lack of an easily accessible API has prevented that so far. I'd be happy to help implement this myself, I've got a bit of Rails experience, but I thought a feature this large warranted a bit of discussion.

To avoid having to deal with authentication at this point it'd probably be best to start it out as a read-only API. The main things I'd want access to as an app developer right now are the top and newest story sections and individual posts.

Have you thought much about the API so far?

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 8, 2012

Contributor

I haven't done any JSON exporting mostly because the site already has a responsive/mobile view that works fine on phones and small screens.

Though I think the structure of the site is pretty well solidified by now, so a stable API can probably be added at this point.

Contributor

jcs commented Dec 8, 2012

I haven't done any JSON exporting mostly because the site already has a responsive/mobile view that works fine on phones and small screens.

Though I think the structure of the site is pretty well solidified by now, so a stable API can probably be added at this point.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 8, 2012

Contributor

Yeah the mobile site is totally serviceable, however I think a native app could still provide a much better experience. I'll look into adding JSON as a response format later today if I get the time.

Contributor

rhysforyou commented Dec 8, 2012

Yeah the mobile site is totally serviceable, however I think a native app could still provide a much better experience. I'll look into adding JSON as a response format later today if I get the time.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 17, 2012

Contributor

Just noticed you've started work on the API, I might throw together a basic iPhone app using it this afternoon if I have time. It'd also be great to include the number of comments and current score in that JSON.

Contributor

rhysforyou commented Dec 17, 2012

Just noticed you've started work on the API, I might throw together a basic iPhone app using it this afternoon if I have time. It'd also be great to include the number of comments and current score in that JSON.

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 18, 2012

Contributor

Ok, added those two in cb5e159

Contributor

jcs commented Dec 18, 2012

Ok, added those two in cb5e159

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 18, 2012

Contributor

Awesome, would it also be possible to add the created_at and updated_at info to the API? It'd help a lot cache expiration on the client side. Also do stories on Lobsters have regular, numerical IDs or just the short_id returned by the current API?

Contributor

rhysforyou commented Dec 18, 2012

Awesome, would it also be possible to add the created_at and updated_at info to the API? It'd help a lot cache expiration on the client side. Also do stories on Lobsters have regular, numerical IDs or just the short_id returned by the current API?

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 18, 2012

Contributor

created_at is exposed now, there is no updated_at. I'd rather not expose any internal id numbers, so short_id should be used for stories. They are guaranteed unique.

User ids are being exported but they should probably use the username as the primary identifier, though usernames can change (not a big deal for caching though).

Contributor

jcs commented Dec 18, 2012

created_at is exposed now, there is no updated_at. I'd rather not expose any internal id numbers, so short_id should be used for stories. They are guaranteed unique.

User ids are being exported but they should probably use the username as the primary identifier, though usernames can change (not a big deal for caching though).

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 18, 2012

Contributor

No problem, my thoughts were that it'd make it easier to generalise some of my code but I've found a workaround anyway.

Contributor

rhysforyou commented Dec 18, 2012

No problem, my thoughts were that it'd make it easier to generalise some of my code but I've found a workaround anyway.

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 18, 2012

Contributor

Ok, removed id from users.

Contributor

jcs commented Dec 18, 2012

Ok, removed id from users.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Awesome, thanks for being so helpful in setting up this API. I've gotten most of the networking and Core Data caching code working in this iPhone app now, but as you can see the UI could use some work.

Screen Shot 2012-12-19 at 2 10 13 PM

Also the source is up at rpwll/LobsterApp, I'll most likely change that name but I couldn't come up with anything clever yet.

Contributor

rhysforyou commented Dec 19, 2012

Awesome, thanks for being so helpful in setting up this API. I've gotten most of the networking and Core Data caching code working in this iPhone app now, but as you can see the UI could use some work.

Screen Shot 2012-12-19 at 2 10 13 PM

Also the source is up at rpwll/LobsterApp, I'll most likely change that name but I couldn't come up with anything clever yet.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Some of the colours are a little dark but here's the direction I'm thinking of taking with the interface design:

Lobsters App Mockup

Contributor

rhysforyou commented Dec 19, 2012

Some of the colours are a little dark but here's the direction I'm thinking of taking with the interface design:

Lobsters App Mockup

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 19, 2012

Contributor

Nice!

Contributor

jcs commented Dec 19, 2012

Nice!

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Yeah I'll start skinning up the current app and add the Newest section to it, if you could at some point add individual posts and users to the API I can do like 80% of what I'd want to with this app. I think having a nice iPhone app could be a great way to get more people using the site.

Right now I'm trying to come up with a way to make nested conversations work well on the iPhone's narrow screen.

Contributor

rhysforyou commented Dec 19, 2012

Yeah I'll start skinning up the current app and add the Newest section to it, if you could at some point add individual posts and users to the API I can do like 80% of what I'd want to with this app. I think having a nice iPhone app could be a great way to get more people using the site.

Right now I'm trying to come up with a way to make nested conversations work well on the iPhone's narrow screen.

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 19, 2012

Contributor

Ok, I'll work on exporting more things.

You should post a link to this on /t/projects and get some feedback from other users.

Contributor

jcs commented Dec 19, 2012

Ok, I'll work on exporting more things.

You should post a link to this on /t/projects and get some feedback from other users.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Yeah I plan to once I've worked on that mockup a bit more

Contributor

rhysforyou commented Dec 19, 2012

Yeah I plan to once I've worked on that mockup a bit more

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Okay here's what I've got so far, a few things that still need to be worked out:

  • I'm not sure how to handle nested comments. Right now comments don't tend to get nested too deeply but that could always change and I want to have a flexible solution for that.
  • Those vote up / down arrows next to each story and comment don't do anything. They're intended to let the user know if they've voted on a post and nothing more. However, right now they look like they're tappable buttons which could be confusing.
  • I'm not sure if we'll be able to have write access in the initial version of the app, so a lot of that stuff might need to be left out.
  • I'm not sure whether to handle URLs by opening them directly in the app or in mobile Safari. Perhaps this could be a preference but to me that just feels like not making a firm decision.

I might post this to /t/projects and get some feedback there.

Lobster App Mockup

Contributor

rhysforyou commented Dec 19, 2012

Okay here's what I've got so far, a few things that still need to be worked out:

  • I'm not sure how to handle nested comments. Right now comments don't tend to get nested too deeply but that could always change and I want to have a flexible solution for that.
  • Those vote up / down arrows next to each story and comment don't do anything. They're intended to let the user know if they've voted on a post and nothing more. However, right now they look like they're tappable buttons which could be confusing.
  • I'm not sure if we'll be able to have write access in the initial version of the app, so a lot of that stuff might need to be left out.
  • I'm not sure whether to handle URLs by opening them directly in the app or in mobile Safari. Perhaps this could be a preference but to me that just feels like not making a firm decision.

I might post this to /t/projects and get some feedback there.

Lobster App Mockup

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 19, 2012

Contributor

Here's the thread if you want to comment

Contributor

rhysforyou commented Dec 19, 2012

Here's the thread if you want to comment

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 22, 2012

Contributor

I'm making some good progress with the app, can I get an ETA on being able to access an individual story and its comments from the API?

Contributor

rhysforyou commented Dec 22, 2012

I'm making some good progress with the app, can I get an ETA on being able to access an individual story and its comments from the API?

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 23, 2012

Contributor

I'm heading out of town today so I probably won't be able to work on this until Friday or the weekend.

Contributor

jcs commented Dec 23, 2012

I'm heading out of town today so I probably won't be able to work on this until Friday or the weekend.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 23, 2012

Contributor

No problem, I'll probably take some time off too. Merry Christmas man.

Contributor

rhysforyou commented Dec 23, 2012

No problem, I'll probably take some time off too. Merry Christmas man.

jcs added a commit that referenced this issue Dec 30, 2012

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Dec 30, 2012

Contributor

You can access a story now by /s/(short id).json which includes a comments array.

https://lobste.rs/s/mbw0z5.json

Contributor

jcs commented Dec 30, 2012

You can access a story now by /s/(short id).json which includes a comments array.

https://lobste.rs/s/mbw0z5.json

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Dec 31, 2012

Contributor

Awesome, thanks so much. I'll probably start work on stories tomorrow and aim for a usable alpha by the end of next weekend.

Contributor

rhysforyou commented Dec 31, 2012

Awesome, thanks so much. I'll probably start work on stories tomorrow and aim for a usable alpha by the end of next weekend.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Jan 5, 2013

Contributor

Okay with the stories API in place, I've started thinking some more about what the single story view should look like, here's my initial stab at the idea:

Single Story 2x

A few notes about the design:

  • Tapping the title of the post opens it in a browser, whether this is safari or an in-app browser like I'm using right now is stll to be determined
  • Perhaps the font size for comments and post text is a little small? I might include a setting to change that
  • When the user scrolls the comments, they slide up over the header, this is a cool effect I've seen in a few places and I think it'd work well here. However I still need to figure out what to do when we have really long post text in the header, maybe make it scroll to a point and then have comments scroll over it?
  • Ideally I'd make usernames and tags tappable buttons but we don't have an API for that stuff yet
  • I haven't figured out a way to act on comments yet

One thing that's noticeably missing here is the post and comments scores, I'm trying to figure out a good way to show those but I haven't figured it out just yet.

What do you think?

Contributor

rhysforyou commented Jan 5, 2013

Okay with the stories API in place, I've started thinking some more about what the single story view should look like, here's my initial stab at the idea:

Single Story 2x

A few notes about the design:

  • Tapping the title of the post opens it in a browser, whether this is safari or an in-app browser like I'm using right now is stll to be determined
  • Perhaps the font size for comments and post text is a little small? I might include a setting to change that
  • When the user scrolls the comments, they slide up over the header, this is a cool effect I've seen in a few places and I think it'd work well here. However I still need to figure out what to do when we have really long post text in the header, maybe make it scroll to a point and then have comments scroll over it?
  • Ideally I'd make usernames and tags tappable buttons but we don't have an API for that stuff yet
  • I haven't figured out a way to act on comments yet

One thing that's noticeably missing here is the post and comments scores, I'm trying to figure out a good way to show those but I haven't figured it out just yet.

What do you think?

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Jan 6, 2013

Contributor

Also, do you have any idea if/when the API will add authenticated write access? I'd love to be able to post replies from my app.

Contributor

rhysforyou commented Jan 6, 2013

Also, do you have any idea if/when the API will add authenticated write access? I'd love to be able to post replies from my app.

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Jan 6, 2013

Contributor

I'll have to look into integrating an OAuth endpoint.

Contributor

jcs commented Jan 6, 2013

I'll have to look into integrating an OAuth endpoint.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Jan 6, 2013

Contributor

OAuth would be the best way to handle this, though I've never implemented OAuth in any of my rails apps so I'm unsure how time consuming that would be.

Contributor

rhysforyou commented Jan 6, 2013

OAuth would be the best way to handle this, though I've never implemented OAuth in any of my rails apps so I'm unsure how time consuming that would be.

@rhysforyou

This comment has been minimized.

Show comment
Hide comment
@rhysforyou

rhysforyou Feb 1, 2013

Contributor

Alrighty, sorry I haven't given a ton of updates over the past month or so, I've been preoccupied with other projects, but I'm still definitely working on a Lobsters iPhone app. I've actually got a pretty solid build of the app running on my phone right now that I've been using to read Lobsters on my commute, it just needs a bunch of polish before I'd be willing to release it to the world.

Right now I'm trying to come up with a good name for the app so feel free to throw any suggestions out there. I assume I can't really call it Lobsters like I am right now. Anyway I plan to do a bunch of work on it this weekend with my plan being to launch it as a read-only client and gradually add other features as the API expands.

Thanks again for helping this project along!

Contributor

rhysforyou commented Feb 1, 2013

Alrighty, sorry I haven't given a ton of updates over the past month or so, I've been preoccupied with other projects, but I'm still definitely working on a Lobsters iPhone app. I've actually got a pretty solid build of the app running on my phone right now that I've been using to read Lobsters on my commute, it just needs a bunch of polish before I'd be willing to release it to the world.

Right now I'm trying to come up with a good name for the app so feel free to throw any suggestions out there. I assume I can't really call it Lobsters like I am right now. Anyway I plan to do a bunch of work on it this weekend with my plan being to launch it as a read-only client and gradually add other features as the API expands.

Thanks again for helping this project along!

@jcs

This comment has been minimized.

Show comment
Hide comment
@jcs

jcs Nov 25, 2014

Contributor

I guess this died :(

Contributor

jcs commented Nov 25, 2014

I guess this died :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment