Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support oEmbed link embed type #118

Open
shawnmjones opened this issue Aug 15, 2018 · 0 comments
Open

Support oEmbed link embed type #118

shawnmjones opened this issue Aug 15, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@shawnmjones
Copy link
Member

MementoEmbed shall support the link type as dictated in the oEmbed standard.

The oEmbed specification uses query parameters to specify behavior, and all arguments must be urlencoded. The spec also states providers are welcome to support custom additional parameters. MementoEmbed will support the following request parameters:

  • url - required by the oEmbed spec, the URI for which to create the embed
  • maxwidth - optional as per the oEmbed spec, the maximum width of the embedded resource, only applies to some resource types
  • maxheight - optional as per the oEmbed spec, the maximum height of the embedded resource, only applies to some resource types
  • format - optional as per the oEmbed spec, the required response format, typically json or xml
  • create_thumbnails - allows the user to specify yes or no in order to control the creation of thumbnails as part of the response
  • type - allows the user to request link or rich, with rich to be supported in a future release

The oEmbed specification provides for 4 embed types: photo, video, link, and rich. Neither photo nor video make sense for most mementos, which leaves link and rich.

rich requires supporting maxwidth and maxheight query string attributes, as mentioned in #100. Unfortunately, MementoEmbed's social cards do not currently support easy resizing to comply with rich. The link type allows MementoEmbed to expose "any generic embed data", permitting us to provide some oEmbed support while other work prepares MementoEmbed to support the additional requirements of the rich type.

The specification states:

Providers may optionally include any parameters not specified in this document (so long as they use the same key-value format) and consumers may choose to ignore these. Consumers must ignore parameters they do not understand.

Thus, we will add our own metadata to make MementoEmbed useful for those that want to generate their own formatted social cards.

Response parameters:

  • type - required by the oEmbed spec, to be set to link
  • version - required by the oEmbed spec, required to be set at 1.0
  • title - optional as per the oEmbed spec, will return the value of MementoSurrogate.title
  • author_name - optional as per the oEmbed spec, likely not available for most mementos so this will not be implemented
  • author_url - optional as per the oEmbed spec, likely not available for most mementos so this will not be implemented
  • provider_name - optional as per the oEmbed spec, the name of the resource provider, to be set to the upper-case archive domain name, as on the card
  • provider_url - optional as per the oEmbed spec, the URI of the archive
  • thumbnail_url - optional as per the oEmbed spec, the data URI for the thumbnail at a size conforming to maxwidth and maxheight
  • thumbnail_width - optional as per the oEmbed spec, the width of the thumbnail
  • thumbnail_height - optional as per the oEmbed spec, the height of the thumbnail
  • originalurl - the URI-R of the resource, as returned from MementoSurrogate.original_uri
  • original_favicon - the favicon of the original resource, as returned from MementoSurrogate.original_favicon
  • provider_favicon - the favicon of the archive, as returned by MementoSurrogate.archive_favicon
  • collection_url - the URI of the collection, if any, as returned by MementoSurrogate.collection_uri
  • collection_name - the name of the collection, if any, as returned by MementoSurrogate.collection_name
  • striking_image - the image provided on the social card, as returned by MementoSurrogate.striking_image
  • description - the text provided on the social card, as returned by MementoSurrogate.text_snippet

HTTP status codes:

  • 200 - if all goes well
  • 404 - if the given URI-M does not exist (from oEmbed spec) or does not refer to a memento, mimicking the behavior of other MementoEmbed services that implement Prefer
  • 501 - if the consumer requests a response in a format other than xml or json (from oEmbed spec)
  • 401 - this will not be implemented as it only applies to non-public resources (from oEmbed spec)
  • 400 - if the consumer requests an embed using an invalid set of properties, see Ensure social card produced by oEmbed endpoint is compliant with size standards #100 for discussion, also currently the behavior for the MementoEmbed services that implement Prefer
  • 500 - if the consumer requests an embed and MementoEmbed fails internally - currently the behavior for the MementoEmbed services that implement Prefer
  • 502 - if there was an issue connecting to the archive - currently the behavior for the MementoEmbed services that implement Prefer
  • 504 - if the connection to the archive timed out - currently the behavior for the MementoEmbed services that implement Prefer

This issue will take the place of #100 and #101. Those issues will be closed. This issue will encompass all initial oEmbed work.

As MementoEmbed was developed with oEmbed in mind, much of the work for this is already done. It just needs to be brought together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant