XML-RPC Protocol Method: editevent

From Dreamwidth Notes
Jump to: navigation, search
Needs Update: This documentation was ported over from LJ's Server Manual with minimal modification. It may not match Dreamwidth's implementation of the method, and needs to be double checked against the DW code and updated as necessary.

Modify an already created event. If fields are empty, it will delete the event.

Inputs

username Scalar. Required. Username of user logging in.

auth_method Scalar. Optional. 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 Deprecated. Scalar. Optional. Password of user logging in in plaintext. If using the "clear" authentication method, either this or "hpassword" must be present.

hpassword Deprecated. Scalar. Optional. MD5 digest of user's password. Not much more secure than password, but at least it's not in plain text.

auth_challenge Scalar. Optional. If using challenge-response authentication, this should be the challenge that was issued to you by the server.

auth_response Scalar. Optional. If using challenge-response authentication, this should be the response hash that you generate, based on the formula required for your challenge.

ver Scalar. Optional. Protocol version supported by the client; assumed to be 0 if not specified. See Protocol Versions for details on the protocol version.

itemid Scalar. Required. The unique ItemID of the item being modified or deleted.

event Scalar. Required. The revised event the user is submitting. Or, to delete an entry, just send no text at all. Carriage returns are okay (0x0A, 0x0A0D, or 0x0D0A), although 0x0D are removed internally to make everything into Unix-style line-endings (just \ns). Posts may also contain HTML, but be aware that the Dreamwidth server converts newlines to HTML <BR>s when displaying them, so your client should not try to insert these itself.

lineendings 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, Dreamwidth 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.

subject Scalar. Required. The subject for this post. Limited to 255 characters. No newlines.

security Scalar. Optional. Specifies who can read this post. Valid values are public (default), private and usemask. When value is usemask, viewability is controlled by the allowmask.

allowmask Scalar. Optional. Relevant when security is usemask. A 32-bit unsigned integer representing which of the user's trust groups are allowed to view this post. Turn bit 0 on to allow anyone with basic access to read it. Otherwise, turn bit 1-30 on for every trust group that should be allowed to read it. Bit 31 is reserved.

props Struct. Optional. Set arbitrary (but restricted) meta-data properties to this entry. See Journal Entries Metadata for the documentation of the keys and value data types.

usejournal Scalar. Optional. If editing a shared journal entry, include this key and the username you wish to edit the entry in. By default, you edit the entry as if it were in user "user"'s journal, as specified above.

year Scalar. Required. If modifying only, the 4-digit year of the event (from the user's local timezone).

mon Scalar. Required. If modifying only, the 1- or 2-digit month of the event (from the user's local timezone).

day Scalar. Required. If modifying only, the 1- or 2-digit day of the month of the event (from the user's local timezone).

hour Scalar. Required. If modifying only, the 1- or 2-digit hour from 0 to 23 of the event (from the user's local timezone).

min Scalar. Required. If modifying only, the 1- or 2-digit minute of the event (from the user's local timezone).

Example Request

POST /interface/xmlrpc HTTP/1.0
User-Agent: XMLRPC Client 1.0
Host: www.dreamwidth.org
Content-Type: text/xml
Content-Length: 1032
 
<?xml version="1.0"?>
<methodCall>
  <methodName>LJ.XMLRPC.editevent</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>itemid</name>
          <value><int>1959</int></value>
        </member>
        <member>
          <name>event</name>
          <value><string>This &lt;strike&gt;is&lt;/strike&gt; was a test post.</string></value>
        </member>
        <member>
          <name>subject</name>
          <value><string>Test</string></value>
        </member>
        <member>
          <name>lineendings</name>
          <value><string>pc</string></value>
        </member>
        <member>
          <name>year</name>
          <value><int>2002</int></value>
        </member>
        <member>
          <name>mon</name>
          <value><int>7</int></value>
        </member>
        <member>
          <name>day</name>
          <value><int>13</int></value>
        </member>
        <member>
          <name>hour</name>
          <value><int>20</int></value>
        </member>
        <member>
          <name>min</name>
          <value><int>35</int></value>
        </member>
      </struct></value>
    </param>
  </params>
</methodCall>

Outputs

itemid Scalar. Required. The unique ItemID of the item being modified or deleted.

anum Scalar. Required. The authentication number generated for this entry. It can be used by the client to generate URLs, but that is not recommended. (See the returned 'url' element if you want to link to a post.)

url Scalar. Required. The permanent link address to this post. This is an opaque string -- you should store it as is. While it will generally follow a predictable pattern, there is no guarantee of any particular format for these, and it may change in the future.

Example Response

HTTP/1.1 200 OK
Connection: close
Content-length: 267
Content-Type: text/xml
Date: Sat, 13 Jul 2002 23:57:17 GMT
Server: Apache/1.3.4 (Unix)
 
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value><struct>
        <member>
          <name>anum</name>
          <value><int>141</int></value>
        </member>
        <member>
          <name>itemid</name>
          <value><int>1959</int></value>
        </member>
      </struct></value>
    </param>
  </params>
</methodResponse>