Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
bradfitz
lj_dev

getting comment data

I've been thinking about making comment data accessible in XML. Follow with me as I ramble.

URLs could be of form:

http://www.ljsite.com/users/foo/234.xml
to mimic:
http://www.ljsite.com/users/foo/234.html

But we don't want to include all text/props, because that could get huge with popular posts like on news. That's shitty to make people poll that.

What if the 234.xml file by default just listed metadata for each comment. So if there were 5,000 comments (typical max for news), and each meta data were line:

<commentref id='353' state='A' parent='0' datepost='yyyymmdd hhmmss' />

And things like state/parent default to 'A' (approved) and zero (top level), then that's like 80 bytes/comment * 5000 comments.... hell, still 390k. (uncompressed, at least) That's a lot to poll.

We could do something like making the base URL

http://www.ljsite.com/users/foo/234.xml

only return the first 1000 comments by default, with a continuation URL in a certain XML element, like:

http://www.ljsite.com/users/foo/234.xml?after=3454

(to get talkids in that post after talkid 3454)

But the problem then is comments' state can change. (between approved, screened, and deleted) That's the only thing about a comment that can change.

What I've been thinking about for the next version of LJ's backend data storage is that each account has a global counter that's incremented for any change: new posts, new comments, any modifications. Then the URL could be: 234.xml?after_revid=123456 and it'd include comment state changes too.

But currently, we have no index on when comment state changes happen.

Alternatively, we could ignore the state field altogether and only provide it when requested. (maybe as one big packed string, but that's lame in XML.... *coughSVGcough*)

Then the next issue: authentication. I like the idea of making the URL each to get to ("REST") as above, though I'm also cool with making it SOAP and/or XML-RPC. (I'm liking SOAP more, having played with C#/Mono) So with SOAP/XML-RPC, we can do Digest auth (avva should be checking it in anyday now). So maybe we can do the same with the REST URLs, instead of requiring people to do hacky stuff to get LJ login cookies.

Perhaps a globally recognized URL parameter to force Digest auth and setup $remote, even if you don't have LJ login cookies:

http://www.ljsite.com/users/foo/234.xml?auth=digest

Now the user sends their Digest auth credentials and we show them all comments, including screened ones.

Thoughts? What does everybody want in terms of interface?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 20 comments