darael: Black lines on a white background.  A circle, with twenty-one straight lines connecting seven equally spaced points. (Default)
Darael ([personal profile] darael) wrote in [site community profile] dw_dev2014-04-20 01:53 am
Entry tags:

On clients and APIs

Dreamwidth's APIs are poorly documented (people basically have to work off docs for old versions of LJ's APIs). They're also missing key features, like comment handling for more than backups.

I've been told there have been "some internal conversations about deprecating the XML-RPC API -- keeping it for backwards compatability, but moving to a much more modern second-gen API", but that nobody has had both the time and the inclination to work on designing such a thing.

Well, this is me, volunteering. To that end, I'm looking for input on what exactly such a new API needs to provide, and whether there's a preferred underlying technology to build on (exempli gratia, stick with XML-RPC? Change to SOAP? Use JSON? RESTful or not? et cetera). What I'm getting at here is that I'm entirely happy to take point, as it were, and to make decisions (especially where there's little or no consensus and someone has to make the call), draw up specs, write docs, and so forth, but the result is highly unlikely to be a really useful API unless I get input from more sources than my own experience and looks at the code.

At this stage, therefore, I want everything you, the reader, have to say on the subject. Use cases especially.

Go.

[personal profile] jewelfox 2014-04-22 12:57 am (UTC)(link)
I occasionally think this, then wonder why it can't be more easily done by making existing site styles more responsive/mobile friendly?

More easily done by whom? >_>

Plus a native Windows / Windows Phone app would have live tile support, and the ability to easily share non-access-locked content.
quartzpebble: (tea or death)

[personal profile] quartzpebble 2014-04-22 07:01 am (UTC)(link)
I'm going to be doing some work around client libraries for the MediaWiki API this summer (https://www.mediawiki.org/wiki/Evaluating_and_Improving_MediaWiki_web_API_client_libraries) so I'll be watching this with interest. If there are any bits that you can hand off to a new dev, I'd be interested in helping out with YAAPI. I'd also be interested in working on the documentation.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-22 07:33 am (UTC)(link)
Agreed.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-22 07:35 am (UTC)(link)
Let's go with OAuth only -- it *may* be possible that we decide we want to support something else in the future, but plenty of APIs support purely OAuth with no problems.

I'd be happy to be able to move away from plaintext username and password!

[personal profile] jewelfox 2014-04-22 07:38 am (UTC)(link)
I might be able to help out with documentation also ... my OPW stint was for writing developer docs, and I'll need to have all this information organized in order to make anything based on it.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-22 07:42 am (UTC)(link)
I like the idea of chopping things into smaller chunks.

Sooooo a suggestion for where to put up the list: let's have an issue on github for each separate feature, grouped under a milestone for each iteration -- that is vs having one issue called "implement API" with everything listed as a comment there ;)
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-22 07:45 am (UTC)(link)
As a potential developer/user of this API, I would like to say: OAuth, REST, JSON.

Yes, yes, and yes.
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-22 08:03 am (UTC)(link)
I don't think that there's much I can add in terms of use case! But I'm pretty excited that you're taking point on this and I'm happy to do what I can to enable you :)

Various fiddly details:

* OAuth / JSON / REST as everyone else above me has said :)
* We should have some form of explicit versioning in the API url for future-proofing, e.g., /api/v1/blah
* strongly in favor of multiple iterations, and I like the break down you already have
* please don't feel the need to copy the existing API functionality exactly! (I don't think you will but I want to emphasize that)

[staff profile] mark and I talked some time back about a new API -- there's some code for uploading files over in DW::Controller::API::Media -- but that doesn't cover authentication yet, because we've only been using it on-site (for AJAX calls).
emperor: (Default)

[personal profile] emperor 2014-04-22 05:33 pm (UTC)(link)
Random ill-formed Things I Would Like:

NNTP :-p

Well, I'm only half-trolling. Consider where I patch my news client to talk to DW, and so each journal is a newsgroup, and each post the head of a usenet thread. Then I can say "Any new posts or comments in [personal profile] emperor?" ; I can visit a particular post/thread and see which comments/articles are new and, if necessary, the already-read context (/comments/articles) surrounding them. This would be Very Cool.

If we're not going to present DW as if it were usenet (shame!), then I think the features I'd like are around making it easier to track new comments as well as articles, for instance:

"What comments on this post are new?"
"What posts in this DW / readinglist have new comments?"

[similar web UI improvements would be grand, too, but that's not what we're talking about here]
fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

[personal profile] fu 2014-04-23 08:57 am (UTC)(link)

Whoo, okay!

I don't think anybody would be bothered by having the discussion in dreamwidth/dw-free, but that also looks like a good place to start :) i don't want to step all over your thought process, but I'll keep an eye on the issues repo for updates.

lovingboth: (Default)

[personal profile] lovingboth 2014-04-23 03:12 pm (UTC)(link)
It's a while ago, but for many years I was a member of CIX, a conferencing system using the CoSy software. Like BIX, but UK-based. Because it charged by the minute and we didn't have any free phone calls, offline readers, like news readers, became popular.

So I'm aware how much easier they make something that is very difficult with the LJ way of doing things: extended discussions involving more than two people. As it is, unless you track a post, you only get notifications to your comments, not for any others, and unless you actively go back to a post to look, you don't see them. Tracking comments is crucial.

When I was pondering doing an OLR for LJ, I looked at the LJ API, but the thing that it was missing was indeed a call that said 'give me all the posts and comments in journal x since time t'.

Doing it via NNTP would save a pile of work, because of how many news readers exist.
damerell: (computers)

[personal profile] damerell 2014-04-23 03:14 pm (UTC)(link)
I realise this is going to be a bit moon-on-a-stick, but in my experience, it's a bad mistake to try and work out what an API needs to do; the API should make it straightforward to do anything one can do through the ordinary human-facing interface.

I say this because I've worked in large organisations where one group writes an API that happens to have this property, and another group, later, does something the first group never imagined. A formal requirements-listing process would have been entirely futile; the second group didn't know the API was being written, and didn't decide in advance what they wanted to do - they got the API and then thought about what they could do with it.
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2014-04-23 10:42 pm (UTC)(link)
And also because people who characterize NNTP as "widely known" or "well supported" haven't taken a good look around in the past decade. There are very, very, very few clients left for Mac or Windows that are actively supported (and they're mostly all shareware or commercialware) and if you asked 100 DW users what NNTP was or if they'd ever heard of a newsreader, you'd get 1 "yes" and it'd be someone who's still reading Usenet with their old copy of tin.

(I mean, I love tin. But the Average User can't run tin.)

[personal profile] swaldman 2014-04-24 05:46 am (UTC)(link)
A slightly higher-level thought / suggestion: Unless there are major performance or other reasons not to, make it an eventual goal for DW's main web interface to use the same new API.

Reasoning: 1. Future code simplification / avoidance of duplication / cleaner front/back end seperation; 2. Enforces the "API clients should be able to do anything the web interface can" ambition that was mentioned above (although of course we might choose not to allow certain actions from anything but the web client)

Of course, I have little experience of such things, and so this might be a silly idea ;-)
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2014-04-24 06:00 am (UTC)(link)

If we were just starting out that would be a great goal, absolutely, but the major argument against doing that now is the same argument explaining why we went with forking LJ to begin with vs starting over from scratch: the epic amount of rewriting it would entail, including the inevitable introduction of a number of bugs. The core functionality of the site (updating, commenting, etc) that the YAAPI will be targeting are the oldest and most hardened areas of the site, with in most cases ... *counts on fingers* 15 or so years of bugfixes and security fixes, etc. You don't throw that out unless there's a very, very, very compelling reason to do so.

Code duplication is less of an argument here (since, again, those areas of the code don't change very frequently so there are fewer opportunities to get out of sync). And really, the amount of work necessary to rewrite the site frontend to use the API as backend is huge, and we just don't have the resources for that. We have enough huge sprawling maintenance tasks outstanding already; we don't need more.

[personal profile] swaldman 2014-04-24 09:32 am (UTC)(link)

nod fair enough.

fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)

Re: OK, so I've been silent for a while

[personal profile] fu 2014-05-06 07:29 pm (UTC)(link)

Hmm. I don't want to get bogged down in details, but these two examples feel like separate things, and the answer to one doesn't necessarily affect the other.

e.g., auth -- I'm strongly in favor of keeping it as simple as possible. Maybe even as simple as /v1/foo/1234?token=xxxx

The difference would be most obvious when testing GET requests, but even with POST requests, sometimes lining things up just right can get fiddly, I'd like to avoid that as much as possible.

HTTP DELETE sounds right. I don't feel very strongly about that vs an empty HTTP POST -- other than that I can imagine a hypothetical where someone accidentally does the latter ;) So using DELETE sounds reasonable.

I guess PATCH vs POST is another possibility?

denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

Re: OK, so I've been silent for a while

[staff profile] denise 2014-05-06 08:16 pm (UTC)(link)

Might be a good idea to post new questions in a followup entry -- dunno how many people will still be watching this one!

lovingboth: (Default)

[personal profile] lovingboth 2014-05-28 10:47 pm (UTC)(link)
It is true that there are fewer news-only programs, but that's probably because mail programs like Thunderbird do NNTP too.

Hmm, track everything of interest and use email to get all comments, hmm.

[personal profile] schilling_klaus 2014-08-07 09:37 pm (UTC)(link)
Gnus, the nntp client built into the GNU Emacs, is cross-platform.

Page 2 of 3