Skip to content

Instantly share code, notes, and snippets.

@voxpelli
Created November 21, 2010 17:47
Show Gist options
  • Save voxpelli/708948 to your computer and use it in GitHub Desktop.
Save voxpelli/708948 to your computer and use it in GitHub Desktop.
Sketch of a possible oEmbed 1.1 autodiscovery mechanism

OEmbed Autodiscovery?

A quick sketch at a possible updated autodiscovery mechanism for oEmbed.

By adding a new link relation, “http://oembed.com/spec/1.1/prop/embed”, that defines an the link to an oEmbed representation of a resource and combining that with the template property of the XRD specifications link tag we get a way to specify an oEmbed endpoint.

Add to that a new property type, http://oembed.com/spec/1.1/prop/scheme, that defines the scheme of such a link and we can make those discoverable as well. Supporting http://oembed.com/spec/1.1/prop/scheme might be optional since all it does is enable consumers to precheck whether an endpoint provides embeds for a class of URI:s or not.

Possibly also add a new property, http://oembed.com/spec/1.1/prop/type, to define which types are to be expected from the endpoint. This would make it possible for eg. those looking for only photos to exclude all oEmbed providers that doesn’t provide photo embeds.

Reference URLs

oEmbed
Host-meta
Web Linking
JSON Resource Descriptor

{
"links":
{
"http://oembed.com/spec/1.1/prop/embed":
[
{
"type":"application/json+oembed",
"template":"http://example.com/oembed?uri={uri}",
"properties":
{
"http://oembed.com/spec/1.1/prop/scheme":[
"http://www.example.com/content/*",
"http://example.com/content/*"
],
"http://oembed.com/spec/1.1/prop/type":[
"photo",
"rich"
],
}
}
]
}
}
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<Link rel='http://oembed.com/spec/1.1/prop/embed'
type='application/xml+oembed'
template='http://example.com/oembed?uri={uri}'>
<Property type="http://oembed.com/spec/1.1/prop/scheme">http://www.example.com/content/*</Property>
<Property type="http://oembed.com/spec/1.1/prop/scheme">http://example.com/content/*</Property>
<Property type="http://oembed.com/spec/1.1/prop/type">photo</Property>
<Property type="http://oembed.com/spec/1.1/prop/type">rich</Property>
</Link>
</XRD>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment