tent.io/content/docs/server-protocol.md
2012-09-16 16:08:38 -03:00

2.7 KiB

Tent Server-Server Communication Protocol

This document describes the protocol that Tent servers use to communicate with each other.

###Basics

Every Tent user is represented by a server. Servers establish and maintain relationships and exchange content between users.

Applications send new content to servers and receive content from the server.

Servers should always be online and be accessible over HTTPS.

Server Discovery

Users and applications discover Tent servers in one of two ways: HTTP Link Headers and HTML link tags. Users can provide multiple links to access their Tent server. Multiple links are usually provided in case a particular address becomes unavailble. When multiple links are listed, they should be listed in order of preference from most preferred to least preferred, and contact attempted in the same order.

The HTTP header allows discovery of Tent servers by performing a HEAD request instead of retrieving the entire page and parsing for the link tag. It should be added to all responses associated with the Tent entity. Other pages associated with the user may also serve the same header.

Link: <https://tent.titanous.com/profile>; rel="https://tent.io/rels/profile"

or

Link: <https://tent.titanous.com/profile>; rel="https://tent.io/rels/profile", <https://titanous.tent.is/profile>; rel="https://tent.io/rels/profile", <https://tent.jonathan.cloudmir.com/profile>; rel="https://tent.io/rels/profile"

The link tag should be placed in the head tag of all HTML pages associated with the Tent entity.

<link href="https://tent.titanous.com/profile" rel="https://tent.io/rels/profile" />

Follow an entity

A follow request is required in order to receive notifications about posts published by an entity.

POST /followers

{create_follower example}

Authentication

All requests should be made using SSL.

Authentication is required to access resources that are not marked as public.

Tent uses MAC Access Authentication for all requests.

All requests must be signed using MAC, and all notifications from the server are signed as well.

Get Current Following

GET /followers/:id

{get_follower example}

Edit Following

PUT /followers/:id

{update_follower example}

Stop Following

DELETE /followers/:id

{delete_follower example}

Fetch Posts

GET /posts

{follower_get_posts example}

GET /posts/:id

{follower_get_post example}

Notifications

Notifications of new content are sent as POST requests to /posts and authenticated using the negotiated credentials.