LJ protocol

Dear Lazyweb,

How do you edit a metadata property on an existing Livejournal entry using the flat protocol?

I'm trying to write a script that will edit all of my old LJ posts to set the new "Comments Locked" property on them, opt_lockcomments=1. (I figure I'll do this for any entry older than a month, to cut down on spam.)

It looks to me like the only way to set a property on an existing LJ entry is to use the "editevent" command, and re-send all existing properties. If you leave the "event" property out, it gets deleted instead of left alone, for example. This seems insanely fragile, but apparently that's how it works.

What I don't understand is how you set arbitrary metadata. This says that "editevent" takes a "prop_name" option to set them, but I don't see how you pass both a prop and a value there. I tried "prop_name=current_music=foo" but that gets "Client error: Unknown metadata: value".

Tags: , , ,

8 Responses:

  1. alierak says:

    "name" is a placeholder there. Try "prop_current_music=foo".

    • jwz says:

      Aha! Thanks.

      Am I right in assuming that I need to re-send all properties of the entry, including all metadata? There's no way to just set a single flag without re-creating the whole entry?

      • alierak says:

        No, at least in the copy I have lying around, it looks like it requires the subject and entry contents, but makes lots of other fields optional / preserved if unspecified. You might want to work on a test entry that has some interesting properties set, or wait for someone more knowledgeable to comment.

  2. duskwuff says:

    Possibly of interest: ljprotocol.pl. A lot of the LJ protocol is poorly documented, if at all, but at least you can grovel around in the source if things don't make sense.