»

getevents

getevents — Download parts of the user's journal.

Mode Description

Given a set of specifications, will return a segment of entries up to a limit set by the server. Has a set of options for less, extra, or special data to be returned.

Arguments

  1. [struct](required)

    Containing keys:

    • username(required):

      • [scalar](required) Username of user logging in.

    • auth_method(optional):

      • [scalar](required) Authentication method used for this request. The default value is "clear", for plain-text authentication. "cookie" and any of the challenge / response methods are also acceptable.

    • password(optional):

      • [scalar](required) DEPRECATED. Password of user logging in in plaintext. If using the "clear" authentication method, either this or "hpassword" must be present.

    • hpassword(optional):

      • [scalar](required) DEPRECATED. MD5 digest of user's password. Not much more secure than password, but at least it's not in plain text.

    • auth_challenge(optional):

      • [scalar](required) If using challenge / response authentication, this should be the challenge that was issued to you by the server.

    • auth_response(optional):

      • [scalar](required) If using challenge / response authentication, this should be the response hash that you generate, based on the formula required for your challenge.

    • ver(optional):

      • [scalar](required) Protocol version supported by the client; assumed to be 0 if not specified. See Chapter 11: Protocol Versions for details on the protocol version

    • truncate(optional):

      • [scalar](required) 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.

    • prefersubject(optional):

      • [scalar](required) 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.

    • noprops(optional):

      • [scalar](required) If this setting is set to true (1), then no meta-data properties are returned.

    • selecttype(required):

      • [scalar](required) 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(optional):

      • [scalar](required) For a selecttype of syncitems, the date (in "yyyy-mm-dd hh:mm:ss" format) that you want to get updates since.

    • year(optional):

      • [scalar](required) For a selecttype of day, the 4-digit year of events you want to retrieve.

    • month(optional):

      • [scalar](required) For a selecttype of day, the 1- or 2-digit month of events you want to retrieve.

    • day(optional):

      • [scalar](required) For a selecttype of day, the 1- or 2-digit day of the month of events you want to retrieve.

    • howmany(optional):

      • [scalar](required) For a selecttype of lastn, how many entries to get. Defaults to 20. Maximum is 50.

    • beforedate(optional):

      • [scalar](required) 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.

    • itemid(optional):

      • [scalar](required) 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.

    • lineendings(required):

      • [scalar](required) 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(optional): 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.

      • [scalar](required) Journal username that authenticating user has 'usejournal' access in, as given in the 'login' mode.

Example 19. Sample call to LJ.XMLRPC.getevents

POST /interface/xmlrpc HTTP/1.0
User-Agent: XMLRPC Client 1.0
Host: www.livejournal.com
Content-Type: text/xml
Content-Length: 786

<?xml version="1.0"?>
<methodCall>
<methodName>LJ.XMLRPC.getevents</methodName>
<params>
<param>

<value><struct>
<member><name>username</name>
<value><string>test</string></value>
</member>
<member><name>password</name>

<value><string>test</string></value>
</member>
<member><name>ver</name>
<value><int>1</int></value>

</member>
<member><name>truncate</name>
<value><int>20</int></value>
</member>
<member><name>selecttype</name>

<value><string>lastn</string></value>
</member>
<member><name>howmany</name>
<value><int>2</int></value>

</member>
<member><name>noprops</name>
<value><boolean>1</boolean></value>
</member>
<member><name>lineendings</name>

<value><string>unix</string></value>
</member>
</struct></value>
</param>
</params>
</methodCall>

Return Values

  1. [struct](required)

    Containing keys:

    • events(required):

      • [array](required) A list of structs for all of the returned events. Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • itemid(required):

            • [scalar](required) The unique integer ItemID of the item being returned.

          • eventtime(required):

            • [scalar](required) The time the user posted (or said they posted, rather, since users can back-date posts) the item being returned.

          • security(required):

            • [scalar](required) If this variable is not returned, then the security of the post is public, otherwise this value will be private or usemask.

          • allowmask(optional):

            • [scalar](required) 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(optional):

            • [scalar](required) 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(required):

            • [scalar](required) 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(optional):

            • [scalar](required) 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(optional):

            • [struct](optional; multiple allowed) Properties and their values for the item being returned.

              Containing keys:

    Example 20. Sample return value for LJ.XMLRPC.getevents

    HTTP/1.1 200 OK
    Connection: close
    Content-length: 1002
    Content-Type: text/xml
    Date: Tue, 16 Jul 2002 00:30:01 GMT
    Server: Apache/1.3.4 (Unix)
    
    <?xml version="1.0"?>
    <methodResponse>
    <params>
    <param>
    <value><struct>
    <member><name>events</name>
    
    <value><array>
    <data>
    <value><struct>
    <member><name>eventtime</name>
    <value><string>2020-02-20 02:20:00</string></value>
    
    </member>
    <member><name>event</name>
    <value><string>yes its true its ...</string></value>
    </member>
    <member><name>anum</name>
    
    <value><int>108</int></value>
    </member>
    <member><name>itemid</name>
    <value><int>1965</int></value>
    
    </member>
    </struct></value>
    <value><struct>
    <member><name>eventtime</name>
    <value><string>2002-07-14 11:17:00</string></value>
    
    </member>
    <member><name>event</name>
    <value><string>Yes, Yes, YES!</string></value>
    </member>
    <member><name>anum</name>
    
    <value><int>66</int></value>
    </member>
    <member><name>subject</name>
    <value><string>Is this private?</string></value>
    
    </member>
    <member><name>itemid</name>
    <value><int>1964</int></value>
    </member>
    </struct></value>
    
    </data>
    </array></value>
    </member>
    </struct></value>
    </param>
    </params>
    </methodResponse>