AtomPub

StatusNet 0.9.7 will support the Atom Publication Protocol ("APP" or "AtomPub") as an API. This document details how the API works.

Authentication
The API supports both HTTP Basic and OAuth.

Service document
The service document for an account is found at /api/statusnet/app/service/ .xml.

Each service document has one workspace ('Main') and four collections:


 * notices : notices generated by the user
 * subscriptions : subscriptions by the user
 * favorites : the user's favorites
 * memberships : the user's group memberships

Collections are identified by the  element(s) in their element.

Notices
The feed of notices, in reverse-chronological order, is at /api/statuses/user_timeline/.atom.

This is a partial feed; navigation links are included in the feed to scroll forward and back.

Normal notices will be represented as Activity Streams events with verb = Post, object-type = Note.

Repeats will be represented as Activity Streams events with verb = Share, and with the activity object being an entry representing a "normal notice".

Posted files will be represented with verb = Post and object-type = Image, File, Video, etc.

Single-notice URL
A single notice will be available as an Activity Streams event at /api/statuses/show/.atom.

Posting a notice
The user posts a notice by sending a POST request containing a single element to the URL of the notice feed. These should have verb = Post, and object-type = Note, but since these are the default values, Atom entries that aren't marked up as Activity Streams objects should be fine to post.

The resulting entry will be returned, per the APP, in Activity Streams format. The location of the notice can be read from the Content-Location HTTP header of the result or from the rel=self URL in the resulting entry.

Editing a notice
Notices in StatusNet cannot be edited. PUT requests to a notice URL will fail.

Deleting a notice
A single notice can be deleted by posting a DELETE HTTP request to the notice's Atom representation.

Subscriptions
The feed of subscriptions, in reverse-chronological order, is at /api/statusnet/app/subscriptions/.atom.

This is a partial feed; it includes the navigation links necessary to scroll forward and back.

Subscriptions are represented as Activity Streams entries with verb = Follow and object-type = Person.

Subscription URL
A subscription has an URL at /api/statusnet/app/subscriptions/ / .atom.

Adding a new subscription
To add a new subscription, POST an Activity Streams with verb = Follow and object-type = Person.

The resulting entry will be returned, per the APP, in Activity Streams format. The location of the subscription can be read from the Content-Location HTTP header of the result or from the rel=self URL in the resulting entry.

Editing a subscription
Subscriptions cannot be edited. PUT requests to the subscription URL will result in an error.

Deleting a subscription
To delete a subscription, send a DELETE HTTP request to the Subscription URL.

Favorites
The feed of the user's favorites, in reverse-chronological order, is at /api/statusnet/app/favorites/ .atom.

This is a partial feed; it includes the navigation links necessary to scroll forward and back.

Favorites are represented as Activity Streams entries with verb = Favorite and object-type = Note.

Favorite URL
Favorite entries have a self URL at /api/statusnet/app/favorites/ / .atom.

Favoriting a notice
To favorite a notice, POST an Activity Streams with verb = Favorite and object-type = Note.

The resulting favorite will be returned, per the APP, in Activity Streams format. The location of the favorite can be read from the Content-Location HTTP header of the result or from the rel=self URL in the resulting entry.

Editing a favorite
Favorites are immutable in StatusNet.

Deleting a favorite
To "unfavorite" a notice, POST a DELETE request to the URL for the favorite.

Groups
A feed of group memberships, in reverse-chron order, is available at /api/statusnet/app/memberships/ .atom.

This is a partial feed; it includes the navigation links necessary to scroll forward and back.

Memberships are represented as activity entries with verb = Join and object-type = Group.

Membership URL
Each membership has a representation at /api/statusnet/app/memberships/ / .atom.

Joining a group
To join a group, POST an activity entry with verb = Join and object-type = Group to the memberships feed.

The resulting membership will be returned, per the APP, in Activity Streams format. The location of the membership can be read from the Content-Location HTTP header of the result or from the rel=self URL in the resulting entry.

Editing group membership
Not possible.

Leaving a group
To leave a group, send a DELETE request to the membership URL.

Compatibility
There's a CLI script to run test cases in tests/atompub. Pass it the username and password of a local account on your site and it'll attempt to connect up and confirm that some basic things work.

More generally, we need to wrassle up some actual AtomPub-based posting clients and see if they work!

Tested AtomPub clients:

Untested:
 * Windows Live blog edity thingy Windows Live Writer