»

getfriends

getfriends — Returns a list of which other LiveJournal users this user lists as their friend.

Mode Description

Returns a verbose list of information on friends a user has listed. Optionally able to include their friends of list, the friends group associated with each user, and a limit on the number of friends to return.

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

    • includefriendof(optional):

      • [scalar](required) If set to 1, you will also get back the info from the "friendof" mode. Some clients show friends and friendof data in separate tabs/panes. If you're always going to load both, then use this flag (as opposed to a tabbed dialog approach, where the user may not go to the second tab and thus would not need to load the friendof data.) friendof request variables can be used.

    • includegroups(optional):

      • [scalar](required) If set to 1, you will also get back the info from the "getfriendgroups" mode. See above for the reason why this would be useful.

    • friendlimit(optional):

      • [scalar](required) If set to a numeric value greater than zero, this mode will only return the number of results indicated. Useful only for building pretty lists for display which might have a button to view the full list nearby.

Example 21. Sample call to LJ.XMLRPC.getfriends

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

<?xml version="1.0"?>
<methodCall>
<methodName>LJ.XMLRPC.getfriends</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>
</struct></value>
</param>
</params>
</methodCall>

Return Values

  1. [struct](required)

    Containing keys:

    • friendgroups(required):

      • [array](required) Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • id(required):

            • [scalar](required) The bit number for this friend group, from 1-30.

          • name(required):

            • [scalar](required) The name of this friend group.

          • sortorder(required):

            • [scalar](required) The sort integer for this friend group, from 0-255.

          • public(required):

            • [scalar](required) Either '0' or '1' for if this friend group is public.

    • friendofs(required):

      • [array](required) Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • username(required):

            • [scalar](required) The username of the friend.

          • fullname(required):

            • [scalar](required) The full name of the friend.

          • type(optional):

            • [scalar](required) The type of journal the friend item is. This value can be one of 'community', 'syndicated', 'news', or 'shared', depending on the journaltype of the account in question. The account is a normal personal account when this value is not sent.

          • fgcolor(required):

            • [scalar](required) The foreground color of the friend item.

          • bgcolor(required):

            • [scalar](required) The background color of the friend item.

          • groupmask(required):

            • [scalar](required) If the group mask is not "1" (just bit 0 set), then this variable is returned with an 32-bit unsigned integer with a bit 0 always set, and bits 1-30 set for each group this friend is a part of. Bit 31 is reserved.

    • friends(required):

      • [array](required) Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • username(required):

            • [scalar](required) The username of the friend.

          • fullname(required):

            • [scalar](required) The full name of the friend.

          • type(optional):

            • [scalar](required) The type of journal the friend item is. This value can be one of 'community', 'syndicated', 'news', or 'shared', depending on the journaltype of the account in question. The account is a normal personal account when this value is not sent.

          • fgcolor(required):

            • [scalar](required) The foreground color of the friend item.

          • bgcolor(required):

            • [scalar](required) The background color of the friend item.

          • groupmask(required):

            • [scalar](required) If the group mask is not "1" (just bit 0 set), then this variable is returned with an 32-bit unsigned integer with a bit 0 always set, and bits 1-30 set for each group this friend is a part of. Bit 31 is reserved.

Example 22. Sample return value for LJ.XMLRPC.getfriends

HTTP/1.1 200 OK
Connection: close
Content-length: 1377
Content-Type: text/xml
Date: Tue, 16 Jul 2002 00:44:23 GMT
Server: Apache/1.3.4 (Unix)

<?xml version="1.0"?>

<methodResponse>
<params>
<param>
<value><struct>
<member><name>friends</name>
<value><array>

<data>
<value><struct>
<member><name>fgcolor</name>
<value><string>#000000</string></value>
</member>

<member><name>username</name>
<value><string>bradfitz</string></value>
</member>
<member><name>fullname</name>

<value><string>Brad Fitzpatrick</string></value>
</member>
<member><name>bgcolor</name>
<value><string>#ffffff</string></value>

</member>
</struct></value>
<value><struct>
<member><name>fgcolor</name>
<value><string>#efcfff</string></value>

</member>
<member><name>username</name>
<value><string>ljfresno</string></value>
</member>
<member><name>fullname</name>

<value><string>Fresno LJ users</string></value>
</member>
<member><name>type</name>
<value><string>community</string></value>

</member>
<member><name>bgcolor</name>
<value><string>#000000</string></value>
</member>
</struct></value>

<value><struct>
<member><name>fgcolor</name>
<value><string>#520155</string></value>
</member>
<member><name>username</name>

<value><string>webkin</string></value>
</member>
<member><name>fullname</name>
<value><string>Ellen Stafford</string></value>

</member>
<member><name>bgcolor</name>
<value><string>#fcddff</string></value>
</member>
</struct></value>

</data>
</array></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>