?

Log in

No account? Create an account
XML-RPC: Problem publishing tags - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

XML-RPC: Problem publishing tags [Dec. 5th, 2006|02:15 am]
LiveJournal Client Discussions

lj_clients

[misterwan]
Hello,

I'm trying to add tags to an entry posted via XML-RPC. Here is what I am sending:

<methodCall>
  <methodName>LJ.XMLRPC.postevent</methodName>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>username</name>
            <value>
              <string>beedash</string>
            </value>
          </member>
          <member>
            <name>password</name>
            <value>
              <string>xxxxxxxxxx</string>
            </value>
          </member>
          <member>
            <name>subject</name>
            <value>
              <string>test tags</string>
            </value>
          </member>
          <member>
            <name>event</name>
            <value>
              <string>blablabla</string>
            </value>
          </member>
          <member>
            <name>security</name>
            <value>
              <string>public</string>
            </value>
          </member>
          <member>
            <name>allowmask</name>
            <value>
              <string>1</string>
            </value>
          </member>
          <member>
            <name>ver</name>
            <value>
              <int>1</int>
            </value>
          </member>
          <member>
            <name>year</name>
            <value>
              <int>2006</int>
            </value>
          </member>
          <member>
            <name>mon</name>
            <value>
              <int>12</int>
            </value>
          </member>
          <member>
            <name>day</name>
            <value>
              <int>4</int>
            </value>
          </member>
          <member>
            <name>hour</name>
            <value>
              <int>17</int>
            </value>
          </member>
          <member>
            <name>min</name>
            <value>
              <int>54</int>
            </value>
          </member>
          <member>
            <name>props</name>
            <value>
              <array>
                <data>
                  <value>
                    <struct>
                      <member>
                        <name>taglist</name>
                        <value>
                          <string>one,two,three</string>
                        </value>
                      </member>
                    </struct>
                  </value>
                </data>
              </array>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>

...And here is what I get:

<struct>
  <member>
    <name>faultString</name>
    <value>
      <string>Bad index while coercing array into hash at /home/lj/cgi-bin/ljprotocol.pl line 2683.</string>
    </value>
  </member>
  <member>
    <name>faultCode</name>
    <value>
      <string>Server</string>
    </value>
  </member>
</struct>

The doc clearly specifies that the array is needed, but if I omit it (and put the struct directly under value) I don't get any error message, the post is published... But tags ignored. What I read on the net is that most people are using the flat protocol; I don't want to use it if possible, because I'm relying on a solid XML-RPC library for error handling.

What's wrong with my call?
linkReply

Comments:
[User Picture]From: int
2006-12-05 02:56 am (UTC)
As far as I can remember, you should have a bunch of structs inside a struct for the properties. The documentation goes on about using an array, but it's totally wrong, and I don't know why it's never been changed. So you'd have a struct called props, and the members of the struct would be structs that have the name as the prop name and the value as the value... I can't remember. Just go overboard using structs and it'll eventually work. *shrugs*
(Reply) (Thread)
[User Picture]From: misterwan
2006-12-05 03:54 am (UTC)
Ok, I found out... It's working *without* the struct, I couldn't see the tags because of my template.

If any LJ staff sees this message, it would be nice to update the doc:
- Don't tell people to use a struct
- Talk about taglist
(Reply) (Thread)
[User Picture]From: pauamma
2006-12-15 10:26 pm (UTC)
Can you file a support request about it? Someone will take it from there.

Disclaimer: not LJ staff, just a support volunteer with a passing interest in clients.
(Reply) (Parent) (Thread)