Card

Represents a rich preview card that is generated using OpenGraph tags from a URL.

{
  "url": "https://www.youtube.com/watch?v=OMv_EPMED8Y",
  "title": "♪ Brand New Friend (Christmas Song!)",
  "description": "",
  "type": "video",
  "author_name": "YOGSCAST Lewis & Simon",
  "author_url": "https://www.youtube.com/user/BlueXephos",
  "provider_name": "YouTube",
  "provider_url": "https://www.youtube.com/",
  "html": "<iframe width=\"480\" height=\"270\" src=\"https://www.youtube.com/embed/OMv_EPMED8Y?feature=oembed\" frameborder=\"0\" allowfullscreen=\"\"></iframe>",
  "width": 480,
  "height": 270,
  "image": "https://files.mastodon.social/preview_cards/images/014/179/145/original/9cf4b7cf5567b569.jpeg",
  "embed_url": ""
}

Required attributes

url

Description: Location of linked resource. Type: String (URL) Version history: Added in 1.0.0

title

Description: Title of linked resource. Type: String Version history: Added in 1.0.0

description

Description: Description of preview. Type: String Version history: Added in 1.0.0

type

Description: The type of the preview card. Type: String (Enumerable, oneOf) - link = Link OEmbed - photo = Photo OEmbed - video = Video OEmbed - rich = iframe OEmbed. Not currently accepted, so won't show up in practice. Version history: Added in 1.3.0

Optional attributes

author_name

Description: The author of the original resource. Type: String Version history: Added in 1.3.0

author_url

Description: A link to the author of the original resource. Type: String (URL) Version history: Added in 1.3.0

provider_name

Description: The provider of the original resource. Type: String Version history: Added in 1.3.0

provider_url

Description: A link to the provider of the original resource. Type: String (URL) Version history: Added in 1.3.0

html

Description: HTML to be used for generating the preview card. Type: String (HTML) Version history: Added in 1.3.0

width

Description: Width of preview, in pixels. Type: Number Version history: Added in 1.3.0

height

Description: Height of preview, in pixels. Type: Number Version history: Added in 1.3.0

image

Description: Preview thumbnail. Type: String (URL) Version history: Added in 1.0.0

embed_url

Description: Used for photo embeds, instead of custom html. Type: String (URL) Version history: Added in 2.1.0

See also

Status
app/serializers/rest/preview_card_serializer.rb

Last updated

Was this helpful?