...
Resource | Method | Description/Payload schema/Response schema | Streaming? |
---|---|---|---|
api2/session | GET,POST,DELETE | Post parameter: token | |
api2/users | GET | ||
api2/users/USERID | GET | ||
api2/user/messages | GET,POST | Get parameter: tag (optional) - Post parameters: message, via (opt), pool (opt), realm (opt), metadata (opt), tags (opt), replyto (opt) | Yes (partially implemented) |
api2/user/followees | GET | ||
api2/user/followers | GET,POST | Post parameter: userId | |
api2/user/followees/USERID | DELETE | ||
api2/user/tracks | GET,POST | Post parameter: track (regex) | |
api2/user/tracks/TRACKID | GET,DELETE | ||
api2/user/tracks/TRACKID/messages | GET |
| Yes |
api2/user/actions | GET,POST | Post parameter: name, test, action | |
api2/user/actions/ACTIONID | GET,PUT,DELETE | Put parameter: enabled (boolean) | |
api2/messages/MESSAGEID | GET | ||
api2/messages | GET,POST |
| Yes |
api2/conversations/CONVERSATIONID | GET | ||
api2/conversations/CONVERSATIONID/messages | GET,POST |
| Yes |
api2/pools | GET,POST | ||
api2/pools/POOLID | GET,DELETE | ||
api2/pools/POOLID/users | GET,POST | Post parameters: realm, userId, permission | |
api2/pools/POOLID/users/USERID | DELETE | ||
api2/pools/POOLID/messages | GET,POST |
| Yes |
One point to note is that some HTTP clients do not currently support the "PUT" or "DELETE" methods, so these may have to be simulated through POST methods with an extra parameter. I think that because of the close mapping to resource verbs, is worth using these methods in the specification and defining the simulation method for the entire API separately.
...
- XMPP - http://xmpp.org/
- AMQP - http://jira.amqp.org/confluence/display/AMQP/Advanced+Message+Queuing+Protocol
- HTTP
- Polling (bad)
- Comet/long-polling - Bayeux - http://svn.cometd.com/trunk/bayeux/bayeux.html
- Reverse HTTP - http://www.reversehttp.net/
- PubSubHubBub? - possibly via Reverse HTTP - http://www.reversehttp.net/demos/endpoint.html
HTTP Comet/long-polling implementation for streams
In general, for any resource URL that indicates streaming is implemented above, we will implement an HTTP-based streaming interface. This interface might better be referred to as a "delta" interface. The URL will behave as follows (we use api2/user/messages as an example):
URL | Request | Query Parameters | Behavior |
---|---|---|---|
api2/user/messages | GET |
| Returns any messages not already read by the client |
api2/user/messages | GET | timeout=20 | If new messages not already read by the client exist, these are returned. If no new messages exist, the request will stall for a number of seconds as defined in the timeout= parameter. If a new message arrives during this time, the request will immediately resolve, returning the new message. |
api2/user/messages | GET | history=10 | Returns the last 10 messages in the timeline |
Please note that this interface is not yet implemented on any of the api2 URLs. Once it is implemented where planned for a URL, the "Yes" above in the "Streaming?" column will be bolded.
Resource/Object/Stream Hierarchy
...