Six Apart Developer Center

Developer Center Home » Product Documentation » LiveJournal »

LJ.XMLRPC.getevents

Posted by Byrne Reese on March 3, 2006

Returns a list of a user's journal entries.

Request Parameters

  • LiveJournal's Common Request Parameters
  • truncate - A value that if greater than or equal to 4, truncates the length of the returned events (after being decoded) to the value specified. Entries less than or equal to this length are left untouched. Values greater than this length are truncated to the specified length minus 3, and then have "... " appended to them, bringing the total length back up to what you specified. This is good for populating list boxes where only the beginning of the entry is important, and you'll double-click it to bring up the full entry. (optional)
  • prefersubject - If this setting is set to true (1), then no subjects are returned, and the events are actually subjects if they exist, or if not, then they're the real events. This is useful when clients display history and need to give the user something to double-click. The subject is shorter and often more informative, so it'd be best to download only this. (optional)
  • noprops - If this setting is set to true (1), then no meta-data properties are returned. (optional)
  • selecttype - Determines how you want to specify what part of the journal to download. Valid values are day to download one entire day, lastn to get the most recent n entries (where n is specified in the howmany field), one to download just one specific entry, or syncitems to get some number of items (which the server decides) that have changed since a given time (specified in the lastsync parameter>). Not that because the server decides what items to send, you may or may not be getting everything that's changed. You should use the syncitems selecttype in conjuntions with the syncitems protocol mode.
  • lastsync - For a selecttype of syncitems, the date (in "yyyy-mm-dd hh:mm:ss" format) that you want to get updates since. (optional)
  • year - For a selecttype of day, the 4-digit year of events you want to retrieve. (optional)
  • month - For a selecttype of day, the 1- or 2-digit month of events you want to retrieve. (optional)
  • day - For a selecttype of day, the 1- or 2-digit day of the month of events you want to retrieve. (optional)
  • howmany - For a selecttype of lastn, how many entries to get. Defaults to 20. Maximum is 50. (optional)
  • beforedate - For a selecttype of lastn, you can optionally include this variable and restrict all entries returned to be before the date you specify, which must be of the form yyyy-mm-dd hh:mm:ss. (optional)
  • itemid - For a selecttype of one, the journal entry's unique ItemID for which you want to retrieve. Or, to retrieve the most recent entry, use the value -1. Using -1 has the added effect that the data is retrieved from the master database instead of a replicated slave. Clients with an "Edit last entry" feature might want to send -1, to make sure the data that comes back up is accurate, in case a slave database is a few seconds behind in replication. (optional)
  • lineendings - Specifies the type of line-endings you're using. Possible values are unix (0x0A (\n)), pc (0x0D0A (\r\n)), or mac (0x0D (\r) ). The default is not-Mac. Internally, LiveJournal stores all text as Unix-formatted text, and it does the conversion by removing all \r characters. If you're sending a multi-line event on Mac, you have to be sure and send a lineendings value of mac or your line endings will be removed. PC and Unix clients can ignore this setting, or you can send it. It may be used for something more in the future.
  • usejournal - If getting the history of a shared journal, include this key and the username you wish to get the history of. By default, you load the history of "user" as specified above. (optional)

Return Values

  • Array of struct of type "Event"

Event Struct

The Event struct contains the following keys or parameters:

  • itemid - The unique integer ItemID of the item being returned.
  • eventtime - The time the user posted (or said they posted, rather, since users can back-date posts) the item being returned.
  • security - If this variable is not returned, then the security of the post is public, otherwise this value will be private or usemask.
  • allowmask - If security is usemask then this is defined with the 32-bit unsigned int bit-mask of who is allowed to access this post.
  • subject - The subject of the journal entry. This won't be returned if "prefersubjects" is set, instead the subjects will show up as the events.
  • event - The event text itself. This value is first truncated if the truncate variable is set, and then it is URL-encoded (alphanumerics stay the same, weird symbols to %hh, and spaces to + signs, just like URLs or post request). This allows posts with line breaks to come back on one line.
  • poster - If the poster of this event is different from the user value sent above, then this key will be included and will specify the username of the poster of this event. If this key is not present, then it is safe to assume that the poster of this event is none other than user.
  • props - Properties and their values for the item being returned.

Sample Request

Sample Response

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.