The Codex page doesn’t give information on how to send a post request (has everything else, like editing categories, to adding media…but no post request…hello!).
Trying to do that in Xpostulate (tcl/tk blog client), like this:
proc wppost {} {
set content [.txt.txt get 1.0 end]
set escaped [string map {
"<" "<"
">" ">"
\" "\""
} $content]
.txt.txt delete 1.0 end
.txt.txt insert insert $escaped
set ptext [.txt.txt get 1.0 {end -1c}]
set time [clock format [clock seconds] -format %G%m%dT%T]
global mypost
set mypost "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<methodName>metaWeblog.newPost</methodName>
<params>
<param><value><string>MyBlog</string></value></param>
<param><value>$::wpname</value></param>
<param><value><string>$::wppswd</string></value></param>
<param><struct>
<member><name>categories</name><value><array><data><value>$::cats</value></data></array></value></member>
<member><name>description</name><value>$ptext</value></member>
<member><name>title</name><value>$::subject</value></member>
<member><name>dateCreated</name><value><dateTime.iso8601>$time</ dateTime.iso8601></value></member>
</struct>
</param>
<param>
<value>
<boolean>1</boolean>
</value>
</param>
</params>
</methodCall>"
set plength [string length $ptext]
set dopost [http::geturl https://$::wpname.wordpress.com/xmlrpc.php -query $::mypost -type "text/xml" ]
set wpstat [http::status $dopost]
set wpresponse [http::data $dopost]
toplevel .rsp
wm title .rsp "Post Status"
frame .rsp.btns
grid [tk::label .rsp.btns.lbl -text "WP says: $wpstat\nPost length: $plength"]
grid [tk::button .rsp.btns.view -text "View Journal" -command {
set wpu "https://$::wpname.wordpress.com"
exec $::brow $wpu &
}]\
[tk::button .rsp.btns.ok -text "DONE" -command {destroy .rsp}]
frame .rsp.txt
text .rsp.txt.t -width 80 -height 20
.rsp.txt.t insert end $wpresponse
pack .rsp.btns -in .rsp -side top -fill x
pack .rsp.txt.t -in .rsp.txt -side top -fill x
pack .rsp.txt -in .rsp -side top -fill x
}
Getting this response:
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>-32700</int></value>
</member>
<member>
<name>faultString</name>
<value><string>parse error. not well formed</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
I am successfully posting to livejournal, dreamwidth, and other Lj clones using the xmlrpc method, but not finding good documentation on the difference between an LJ post and a WP post.
Clearly, some LJ props (current_mood, current_music) are not relevant, etc.
The above xml attempt is based on info from https://msdn.microsoft.com/en-us/library/aa905673.aspx
Any idea where my xml is malformed?
Am I missing a relevant or required variable?
Any ideas?
thanks
tony