editfriends

editfriends — Add, edit, or delete friends from the user's Friends list.

Mode Description

Takes up to two lists, one of friends to delete and one of friends to add. Several options are allowed to be specified when adding a friend. It returns a verbose list of the friends added, if any were.

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 27, Protocol Versions for details on the protocol version.

    • delete(optional):

      • [array](required) A list of variable of this form removes the friend users from the user's Friend list. It is not an error to delete an already non-existent friend. The value should just be 1. Containing items:

        • [scalar](optional; multiple allowed) A username of a friend to remove.

    • add(optional):

      • [array](required) To add friends, send a variable list of this form. Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • username(required):

            • [scalar](required) A username of a friend to remove.

          • fgcolor(optional):

            • [scalar](required) Sets the text color of the friend being added. This value is a HTML-style hex-triplet, and must either be of the form #rrggbb or not sent at all. By default, the value assumed is #000000, black.

          • bgcolor(optional):

            • [scalar](required) Sets the background color of the friend being added. This value is a HTML-style hex-triplet, and must either be of the form #rrggbb or not sent at all. By default, the value assumed is #FFFFFF, white.

          • groupmask(optional):

            • [scalar](required) Sets this user's groupmask. Only use this in clients if you've very recently loaded the friend groups. If your client has been loaded on the end user's desktop for days and you haven't loaded friend groups since it started, they may be inaccurate if they've modified their friend groups through the website or another client. In general, don't use this key unless you know what you're doing.

Example 11. Sample call to LJ.XMLRPC.editfriends

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

<?xml version="1.0"?>
<methodCall>
<methodName>LJ.XMLRPC.editfriends</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>add</name>
<value><array>
<data>
<value><struct>
<member><name>username</name>

<value><string>bradfitz</string></value>
</member>
<member><name>fgcolor</name>
<value><string>#000000</string></value>

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

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


Return Values

  1. [struct](required)

    Containing keys:

    • added(optional): A list of the users who have been added with this transaction.

      • [array](required) Containing items:

        • [struct](optional; multiple allowed)

          Containing keys:

          • username(required):

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

          • fullname(required):

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

Example 12. Sample return value for LJ.XMLRPC.editfriends

HTTP/1.1 200 OK
Connection: close
Content-length: 420
Content-Type: text/xml
Date: Mon, 15 Jul 2002 23:52:18 GMT
Server: Apache/1.3.4 (Unix)

<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><struct>
<member><name>added</name>

<value><array>
<data>
<value><struct>
<member><name>username</name>
<value><string>bradfitz</string></value>

</member>
<member><name>fullname</name>
<value><string>Brad Fitzpatrick</string></value>
</member>
</struct></value>

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