Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-08-30 15:08:57

wortwart
Member
Registered: 2013-08-30
Posts: 2

How do I login with XMLRPC?

I’m about to set up my text editor to publish blog posts in Textpattern via XMLRPC. I turned on XMLRPC in the blog backend and studied some documentation:

http://txp.kusor.com/rpc-api
http://www.tutorialspoint.com/xml-rpc/xml_rpc_request.htm
http://www.movabletype.org/documentation/man/MT/XMLRPC.html

Then I used wget to send some code to http://my/blog/rpc in a POST request like this:

<?xml version="1.0"?>
<methodCall>
   <methodName>mt.supportedMethods</methodName>
</methodCall>

The XMLRPC server answers, but only with a generic message. Obviously I need to login somehow but I don’t know how. Passing “username” (or “user”) and “password” as URL arguments doesn’t work, nor does user:password@server. Do I have to put my login credentials into the XMLRPC code? But how?

I’m stuck. Thanks for your help!

Offline

#2 2013-08-30 16:46:58

Gocom
Plugin Author
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How do I login with XMLRPC?

You authenticate using the request body with parameter fields username and password; where the credentials are any of your user accounts. This is outlined in Kusor’s docs. Textpattern itself doesn’t have its own XML-RPC API, but implements some seriously old legacy API from Blogger, MetaWeblog and MovableType. Authentication happens the same way as in those legacy APIs.

Keep in mind that the XML-RPC is almost useless, only supports posting articles and even then just few set fields, since this isn’t our own API, plus nothing uses XML-RPC. The XML-RPC implementation was written back in 2005 and haven’t been touched since then, outside from the added option to disable it from Preferences panel.

Example XML-RPC request to post a new article would probably look something comical like:

POST /rcp HTTP/1.0
User-Agent: Mandatory made up user-agent
Host: example.com
Content-Type: text/xml; charset=utf-8

<?xml version="1.0"?>
<methodCall>
    <methodName>metaWeblog.newPost</methodName>
    <params>
        <param>
            <value><string>appid</string></value>
        </param>
        <param>
            <value><string>section</string></value>
        </param>
        <param>
            <value><string>username</string></value>
        </param>
        <param>
            <value><string>password</string></value>
        </param>
        <param>
            <struct>
                <member>
                    <name>description</name>
                    <value><string>Article body contents.</string></value>
                </member>
                <member>
                    <name>title</name>
                    <value><string>My title</string></value>
                </member>
                <member>
                    <name>categories</name>
                    <value>
                        <array>
                            <data>
                                <value><string>category1</string></value>
                                <value><string>category2</string></value>
                            </data>
                        </array>
                    </value>
                </member>
            </struct>
        </param>
        <param>
                <value><boolean>1</boolean></value>
        </param>
    </params>
</methodCall>

…or something else. I don’t really remember this 90’s stuff. Only thing I do, is that the spec is hysterically comical. If I got that right, like why is the request body like that? That is close to unreadable., and it even doesn’t try to be compressed format. Didn’t they have attributes, namespaces and freely nameable tags in XML back in 90’s? Who seriously would implement ordered anonymous nested parameters?

We really should redo a restful HTTP API, using oAuth and well mapped JSON/XML bodies for responses.

Last edited by Gocom (2013-08-30 16:51:38)

Offline

#3 2013-08-30 18:46:31

wortwart
Member
Registered: 2013-08-30
Posts: 2

Re: How do I login with XMLRPC?

Thanks a lot, Gocom! I finally understood the concept of this weird specification (sorry, Dave Winer). As far as I see XMLRPC is the only way to remote control Textpattern, so I’ll have to stick to that. As I only want to post and maybe update it should do (I hope).

Offline

#4 2014-09-17 20:06:37

PeterS1971
New Member
Registered: 2014-09-17
Posts: 1

Re: How do I login with XMLRPC?

Hello,

I was looking about how to post using XMLRPC and I kinda have the same problem. But Gocom, with this solution username and password would go in plane text right ?

Isn’t there a way to send and store encrypted passwords ?

Thanks
Kind Regards
Peter S.

Offline

#5 2014-09-19 20:27:43

Gocom
Plugin Author
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How do I login with XMLRPC?

PeterS1971 wrote #283842:

Isn’t there a way to send and store encrypted passwords ?

You are free to use SSL. The credentials are as exposed as with any webpage viewed through HTTP.

Offline

Board footer

Powered by FluxBB