4.3 KiB
title |
---|
Protocol Introduction |
API Overview
Tent is a social layer over HTTP using JSON.
Requests are authenticated with HMAC signatures, and apps use OAuth 2 to access content on behalf of users.
Users
Tent users are called entities and identified by a URI.
Example: John Smith's entity might be `https://johnsmith.me/.
A HEAD request to
https://johnsmith.me/
would respond with a Link
header pointing to
a Tent profile (e.g. https://tent.johnsmith.me/profile
)
Servers
Tent servers are the protocol core. They represent the users and maintain their data and relationships. Servers also handle these responsibilities:
- Persisting data
- Notifying other servers about new data
- Ensuring content is only pushed to recipients accepting associated licences
- Managing a list of servers (entities) it is following
- Managing a list of servers (entities) that are following it
- Authorizing apps to access data
- Notifying apps about new or modified data to which they have access
tentd is the current reference Tent server.
Apps
Users create and view posts and profiles on apps. Apps must authenticate with the user's server before content can be posted or viewed.
The Process:
- User A creates a
status
post on her app. - App sends posts to user A's server.
- User A's Server sends post notifications to all users who follow User A's
status
posts and users mentioned in this post. The server will not send notifications to users not allowed in the post's permissions. - The servers operated by user A's followers each receive this notification.
- These servers each send the post to the appropriate app(s).
- The following users can view the post on their apps.
TentStatus is an open source Tent app for creating and viewing status posts.
Posts
Posts are at the core of Tent. Posts are sent to followers immediately after being created.
Users set permissions on each post that determine which other users can access them. Other users can fetch public posts individually or over a date range.
Post types describe the format and content of each post. Tent posts can be used for almost anything, and developers can create new post types for different kinds of media, interactions, or applications.
This documentation describes four basic post types: status
, short messages of 256 characters or less, essay
, longer form writing, photo
, pictures, and album
, a collection of photo
posts.
Profiles
Every Tent entity's server has a profile JSON file describing it. Profiles store information about the user, specifically static information that should always be accessible.
The most basic profile has a single object containing the Tent version, the entity name (e.g. johnsmith.me), an array of supported licences, and an array of servers containing canonical API roots.
A user may have multiple versions of the same info type in their profile.
Notifications
Tent notifications are used when a server needs to let another server or app know about new content updates. This includes new posts and profile changes. Notifications are JSON POST requests containing posts. A new notification is sent for event (post, following event, profile change).
Example
https://cloudmir.com/ (Lindsay) and https://titanous.com (Jonathan) are both following https://daniel.tent.is (Daniel) and have requested all his status posts.
-
https://daniel.tent.is creates a
status
post with TentStatus, a microblogging app, in which he mentions another user, https://jesse.tent.is (Jesse). -
TentStatus sends this post to Daniel's server.
-
Daniel's server sends post notifications to Lindsay and Jonathan, because they follow Daniel and requested all
status
posts he creates, and Jesse, because the post mentions him. -
Lindsay, Jonathan, and Jesse's servers receive the post and send a copy of the post to TentStatus, the application they each have configures to read
status
posts. -
Lindsay, Jonathan, and Jesse can each read, reply to, repost, or ignore the post as they wish.