Embetty Server API Reference
The @embetty/server
provides a RESTful API to fetch data for the frontend components. All endpoints are prefixed by the server's base URL.
General
GET /version
Returns the current version of the @embetty/server
package.
- Success Response:
- Code: 200 OK
- Content:
{"version":"3.2.12"}
Tweets
These endpoints are available under the /tweet
path.
GET /tweet/:id
Retrieves the data for a single tweet.
- URL Params:
id=[string]
(The tweet ID) - Success Response:
- Code: 200 OK
- Content: A JSON object matching the
EmbettyTweet
type, containing tweet data, user info, media, and link metadata.
- Error Responses:
400 Bad Request
: If the ID is not a valid numerical string.404 Not Found
: If the tweet does not exist or is private.
GET /tweet/:id.amp
Returns a self-contained HTML page for embedding the tweet in an AMP document via <amp-iframe>
.
Image Endpoints
GET /tweet/:id/profile-image
: Returns the profile image of the tweet's author.GET /tweet/:id/images/:number
: Returns a specific image attached to the tweet.:number
is the zero-based index of the image.GET /tweet/:id/link-image
: If the tweet contains a URL with a preview card, this returns the image from that card.
Mastodon
These endpoints are available under the /mastodon
path.
GET /mastodon/:statusUrl(*)
Retrieves data for a Mastodon status. The :statusUrl
should be the full, URL-encoded path to the status.
- URL Params:
statusUrl=[string]
(e.g.,https://mastodon.social/@Gargron/109322849503592236
) - Success Response:
- Code: 200 OK
- Content: A JSON object with the status data.
GET /mastodon/:statusUrl(*).amp
Returns a self-contained HTML page for embedding the Mastodon status in an AMP document.
Image Endpoints
GET /mastodon/:statusUrl(*)/profile-image
: Returns the profile image of the status's author.GET /mastodon/:statusUrl(*)/images/:number
: Returns a specific image attached to the status.GET /mastodon/:statusUrl(*)/link-image
: Returns the image from a link card if present.
Videos
YouTube
GET /video/youtube/:id
: Retrieves data (currently empty response, for consistency).GET /video/youtube/:id.amp
: Returns the AMP embed page for a YouTube video.GET /video/youtube/:id-poster-image
: Returns the high-quality poster image for the video.
Vimeo
GET /video/vimeo/:id
: Retrieves metadata for a Vimeo video from the Vimeo API.GET /video/vimeo/:id.amp
: Returns the AMP embed page.GET /video/vimeo/:id-poster-image
: Returns the poster image.
GET /video/facebook/:id
: Retrieves metadata for a Facebook video.GET /video/facebook/:id.amp
: Returns the AMP embed page.