When you send a request, you'll get a response in XML that looks like this:
<root>
<code>1</code>
<errors></errors>
<active_key>readonly</active_key>
<language>en</language>
<pubdate>2009-07-25T23:14:15-06:00</pubdate>
[Data in XML format - see individual method docs]
</root>
If there's an error, the response code field will be set to 0 and all relevant errors will be included in the XML content.
<root>
<code>0</code>
<errors>
<error>[Error text provided]<error>
<error>[Error text provided]<error>
</errors>
<root>
Members authentication
You can identify a member by STFU account via the API, by sending their login and password (MD5 encrypted):
POST http://www.youstfu.com/api/account/login/<login>/<pass_md5>
(returns token which is obligate to access to data changing operations)
By calling up this method (in POST), you will receive a character chain called token, that you will need to act upon their account via the API:
Method: view/
Displays the STFU in several ways:
GET http://www.youstfu.com/api/view/last/<page>
Displays the latest STFUs displayed on the website by pages of 15 items.
GET http://www.youstfu.com/api/view/random
Displays a random STFU with it’s comments.
GET http://www.youstfu.com/api/view/top/<page>
EXAMPLES:
view/top - sorts items by vote_yes
view/top_day - most popular today
view/top_week - this week
view/top_month - this month
view/top_week/5 - fifth page of most popular
Displays the top STFUs. To specify an interval, change the parameter to: top_day / top_week / top_month
GET http://www.youstfu.com/api/view/flop/<page>
Displays the flop STFUs. To specify an interval, change the parameter to: flop_day / flop_week / flop_month
GET http://www.youstfu.com/api/view/<cat>/<page>
Displays the latest STFUs in the selected category, by pages of 15 items. The parameter can be: love / money / kids / work / health / sex / miscellaneous
GET http://www.youstfu.com/api/view/<number>[/nocomment]
Displays the STFU #[number] with its associated comments. Add the /nocomment parameter to not display the comments.
POST http://www.youstfu.com/api/view/search?search=<string>
(EXAMPLE: search?search=Cool - will show stories containing Cool)
Displays the STFUs corresponding to the search. To see the tips, have a look at the page concerning searches on STFU. Be careful, this is done in POST !
GET http://www.youstfu.com/api/view/categories
Displays the categories available on the site.
GET http://www.youstfu.com/api/view/new
Displays the members unread STFUs.
GET http://www.youstfu.com/api/view/favorites
Displays the members favorite STFUs.
Method: /vote
This action allows voting for STFUs via the API. This function is for STFU members only (token).
GET http://www.youstfu.com/api/vote <number>/<type>
Unique function of the vote action, replace with the number of the STFU being voted for, and maybe the type: yes / no
Method: /submit
Sends a STFU. This function is for STFU members only (token).
GET http://www.youstfu.com/api/submit
Be careful, the elements of the form are submitted in parameters:
&author= // STFU author
&cat=STFU // Category
&text= // Text
&mail= // E-mail address (optional)
The category at the moment can be only 'STFU'. The same restrictions for the submission of a STFU via the site apply: notably the limitation of 300 characters.
Method: /comment
Send a comment on a STFU:
GET http://www.youstfu.com/api/comment
Be careful, the elements of the form are submitted in parameters:
&id= // STFU ID
&text= // Text
&url= // Website (optional)
The user posting a comment must be a STFU member, and identified as such via the API (token).
Method: /account
Utilities for the members accounts:
GET http://www.youstfu.com/api/account/signup?mail=<mail>&login=<login>&pass=<pass>
(creates new user)
Sign up for a new account. Either in POST or GET.
GET http://www.youstfu.com/api/account/infos
Returns the information about the identified account.
GET http://www.youstfu.com/api/account/favorites/[add|delete]/<id>
(adds or removes stories to/from favorites)
Add/delete a specified STFU to/from the user's favorites.
GET http://www.youstfu.com/api/account/logout/[token]
Deletes the API’s basic token to completely disconnect the member.