### oEmbed Consumer Request Examples
Source: http://oembed.com
These examples show how a consumer makes an HTTP GET request to an oEmbed provider's API endpoint to request embedding information for a given URL.
```http
http://www.flickr.com/services/oembed/?format=json&url=http%3A//www.flickr.com/photos/bees/2341623661/
```
```http
http://flickr.com/services/oembed?url=http%3A//flickr.com/photos/bees/2362225867/
```
```http
http://flickr.com/services/oembed?url=http%3A//flickr.com/photos/bees/2362225867/&maxwidth=300&maxheight=400&format=json
```
--------------------------------
### oEmbed Discovery Link Element Example
Source: http://oembed.com
Demonstrates how to use link elements in HTML to make oEmbed support discoverable. Includes examples for both JSON and XML formats.
```html
```
--------------------------------
### oEmbed Discovery Link Header Example
Source: http://oembed.com
Shows how to advertise oEmbed support using Link headers in HTTP responses. Provides examples for JSON and XML formats.
```http
Link: ; rel="alternate"; type="application/json+oembed"; title="Bacon Lollys oEmbed Profile"
Link: ; rel="alternate"; type="text/xml+oembed"; title="Bacon Lollys oEmbed Profile"
```
--------------------------------
### Link oEmbed Request Example
Source: http://oembed.com
An example of an oEmbed request for a link, specifying XML format.
```http
http://iamcal.com/oembed/?url=http%3A//www.iamcal.com/linklog/1206113631/&format=xml
```
--------------------------------
### YouTube Video oEmbed Request Example
Source: http://oembed.com
An example of an oEmbed request for a YouTube video, specifying JSON format.
```http
https://www.youtube.com/oembed?url=https%3A//youtube.com/watch%3Fv%3DM3r2XDceM6A&format=json
```
--------------------------------
### oEmbed Provider Response Example (JSON)
Source: http://oembed.com
This is an example of a JSON response from an oEmbed provider, typically containing details about an embedded resource like a photo.
```json
{
"version": "1.0",
"type": "photo",
"width": 240,
"height": 160,
"title": "ZB8T0193",
"url": "http://farm4.static.flickr.com/3123/2341623661_7c99f48bbf_m.jpg",
"author_name": "Bees",
"author_url": "http://www.flickr.com/photos/bees/",
"provider_name": "Flickr",
"provider_url": "http://www.flickr.com/"
}
```
--------------------------------
### Link oEmbed Response Example
Source: http://oembed.com
A sample XML response from an oEmbed provider for a link type.
```xml
1.0linkCal Hendersonhttp://iamcal.com/86400iamcal.comhttp://iamcal.com/
```
--------------------------------
### JSON Response Example
Source: http://oembed.com
A basic JSON response structure for oEmbed. Consumers can request this format by specifying 'format=json'.
```json
{
"foo": "bar",
"baz": 1
}
```
--------------------------------
### XML Response Example
Source: http://oembed.com
A basic XML response structure for oEmbed. Consumers can request this format by specifying 'format=xml'. The root element must be 'oembed'.
```xml
bar1
```
--------------------------------
### YouTube Video oEmbed Response Example
Source: http://oembed.com
A sample JSON response from an oEmbed provider for a YouTube video, including HTML embed code.
```json
{
"version": "1.0",
"type": "video",
"provider_name": "YouTube",
"provider_url": "https://youtube.com/",
"width": 425,
"height": 344,
"title": "Amazing Nintendo Facts",
"author_name": "ZackScott",
"author_url": "https://www.youtube.com/user/ZackScott",
"html":
""
}
```
--------------------------------
### XML Response with Escaped HTML
Source: http://oembed.com
An example of an XML response containing HTML content, where the HTML is properly escaped as PCDATA.
```xml
<b>awesome!</b>
```
--------------------------------
### oEmbed Video Type Parameters
Source: http://oembed.com
Details the parameters for the 'video' resource type, including the HTML for embedding, and required width and height.
```APIDOC
## oEmbed Video Type
### Description
This type is used for representing playable videos. Responses must obey `maxwidth` and `maxheight` request parameters. If a thumbnail is desired, the 'photo' response type should be used instead.
### Parameters
#### Video Specific Parameters
- **html** (string) - Required - The HTML required to embed a video player. Should have no padding or margins.
- **width** (integer) - Required - The width in pixels required to display the HTML.
- **height** (integer) - Required - The height in pixels required to display the HTML.
```
--------------------------------
### oEmbed Response Parameters
Source: http://oembed.com
Details the common parameters available in all oEmbed response types, including type, version, title, author information, provider details, cache age, and thumbnail information.
```APIDOC
## oEmbed Response Parameters
### Description
This section details the common parameters that are valid for all oEmbed response types. These parameters provide metadata about the resource being embedded.
### Parameters
#### Common Response Parameters
- **type** (string) - Required - The resource type (e.g., 'photo', 'video', 'link').
- **version** (string) - Required - The oEmbed version number. Must be '1.0'.
- **title** (string) - Optional - A text title describing the resource.
- **author_name** (string) - Optional - The name of the author or owner of the resource.
- **author_url** (string) - Optional - A URL for the author or owner of the resource.
- **provider_name** (string) - Optional - The name of the resource provider.
- **provider_url** (string) - Optional - The URL of the resource provider.
- **cache_age** (integer) - Optional - Suggested cache lifetime in seconds.
- **thumbnail_url** (string) - Optional - URL to a thumbnail image representing the resource. Must be accompanied by `thumbnail_width` and `thumbnail_height`.
- **thumbnail_width** (integer) - Optional - The width of the optional thumbnail in pixels. Must be accompanied by `thumbnail_url` and `thumbnail_height`.
- **thumbnail_height** (integer) - Optional - The height of the optional thumbnail in pixels. Must be accompanied by `thumbnail_url` and `thumbnail_width`.
### Response Example
```json
{
"type": "photo",
"version": "1.0",
"title": "Example Photo",
"author_name": "John Doe",
"author_url": "http://example.com/johndoe",
"provider_name": "Example Provider",
"provider_url": "http://example.com",
"cache_age": 3600,
"thumbnail_url": "http://example.com/thumbnail.jpg",
"thumbnail_width": 150,
"thumbnail_height": 100,
"url": "http://example.com/image.jpg",
"width": 640,
"height": 480
}
```
```
--------------------------------
### oEmbed Photo Type Parameters
Source: http://oembed.com
Defines the specific parameters for the 'photo' resource type, including the image URL, width, and height.
```APIDOC
## oEmbed Photo Type
### Description
This type is used for representing static photos. Responses must obey `maxwidth` and `maxheight` request parameters.
### Parameters
#### Photo Specific Parameters
- **url** (string) - Required - The source URL of the image. Must be an HTTP or HTTPS URL.
- **width** (integer) - Required - The width in pixels of the image specified in the `url` parameter.
- **height** (integer) - Required - The height in pixels of the image specified in the `url` parameter.
```
--------------------------------
### oEmbed XML Response Format
Source: http://oembed.com
Details the format for XML responses, including the required mime-type and root element structure.
```APIDOC
## XML Response Format
### Description
XML responses must use the `text/xml` mime-type. The format can be requested by specifying a `format` of `xml` in the request. The response body must contain well-formed XML with a root element called `oembed` and child elements for each key.
### Response Example
```xml
bar1
```
Values should be escaped PCDATA. For example:
```xml
<b>awesome!</b>
```
All text must be UTF-8 encoded.
```
--------------------------------
### oEmbed Link Type
Source: http://oembed.com
Describes the 'link' resource type, which allows providers to return generic embed data without specific media URLs.
```APIDOC
## oEmbed Link Type
### Description
This type allows a provider to return generic embed data (such as `title` and `author_name`) without providing specific media URLs or HTML. The consumer may then link to the resource using the URL from the original request.
```
--------------------------------
### oEmbed JSON Response Format
Source: http://oembed.com
Specifies the format for JSON responses, including the required mime-type and structure.
```APIDOC
## JSON Response Format
### Description
JSON responses must contain well-formed JSON and use the `application/json` mime-type. The format can be requested by specifying a `format` of `json` in the request.
### Response Example
```json
{
"foo": "bar",
"baz": 1
}
```
All text must be UTF-8 encoded.
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.