API
For developers who want to integrate doingText with their own web service or desktop product we provide a REST API.
In order to use the API you need a doingText account. For authentication please provide your doingText login/password using HTTP BASIC authentication for all API requests.
For now the API supports the following features:
View a user's list of discussions
To view the list of discussions issue a GET request to the URL http://doingtext.com/profile.xml providing your user credentials via BASIC authentication. You will get back an XML document describing your discussions:
<?xml version="1.0" encoding="UTF-8"?>
<discussions>
<discussion>
<created-at>2009-03-31T15:49:08+02:00</created-at>
<permalink>sntzsv</permalink>
<published>false</published>
<title>my test discussion</title>
<updated-at>2009-03-31T15:49:08+02:00</updated-at>
</discussion>
</discussions>
View a single discussion including comments
To view a single discussion issue a GET request to the URL http://doingtext.com/discussions/PERMALINK.xml where PERMALINK is the permalink of the discussion which you can extract from the list of discussions. The resulting XML document will look like this:
<?xml version="1.0" encoding="UTF-8"?>
<discussion>
<created_at>Tue Mar 31 15:53:44 +0200 2009</created_at>
<updated_at>Tue Mar 31 15:54:12 +0200 2009</updated_at>
<permalink>rfsrrm</permalink>
<title>test discussion</title>
<lines>
<line>
<color></color>
<content><![CDATA[ test discussion]]></content>
<position>1</position>
<created_at>Tue Mar 31 15:53:44 +0200 2009</created_at>
<updated_at>Tue Mar 31 15:53:44 +0200 2009</updated_at>
<version>1</version>
<user_name></user_name>
<comments>
<comment>
<created_at>Tue Mar 31 15:54:12 +0200 2009</created_at>
<updated_at>Tue Mar 31 15:54:12 +0200 2009</updated_at>
<line_update>false</line_update>
<content><![CDATA[ test comment]]></content>
<user_name>alex</user_name>
</comment>
</comments>
</line>
</lines>
</discussion>
Create a new discussion
To create a discussion issue a POST request to the url http://doingtext.com/discussions.xml. The HTTP payload should include the following parameters:
- discussion[title] - optional. if you don't provide one the title will be extracted from the first line of the content.
- discussion[permalink] - optional. if you don't pass one in a unique permalink will be generated for you.
- discussion[content] - required. the contents of your discussion, each line separated by a line break (\n)
An example POST body could look like this:
discussion[title]=my+discussion&discussion[permalink]=my-discussion \
&discussion[content]=line+one
After a successful POST you will be redirected to the discussion's XML view.
