mardi 27 juin 2017

Which design pattern/approach would be appropriate for implementing oEmbed api?

I would like to add oEmbed tags to my site (I'm the oEmbed api provider). My api should respond the results based on the file type.

oEmbed Types has

  • Photo
  • Video
  • Link
  • Rich

My response to photo contains the following field

{
    "author_name": "rajasuba.s",
    "author_url": <author_image_url>,
    "thumbnail_width": 130,
    "provider_url": <provider_url>,
    "thumbnail_url": "<thumbnail_image_url>",
    "title": "Picture.png",
    "provider_name": "XYZ",
    "type": "photo",
    "version": "1.0",
    "url": "<given_url>",
    "thumbnail_height": 120
}

My response to video contains the following field

{
    "author_name": "rajasuba.s ",
    "author_url": "<image_url_of_author>",
    "thumbnail_width": 130,
    "html": "<iframe src="<source_url>" width=\"480\" height=\"270\" frameborder=\"0\">",
    "provider_url": "<service_url>",
    "thumbnail_url": "<thumbnail_image_url>",
    "title": "video_small_resource.mp4",
    "provider_name": "XYZ",
    "type": "video",
    "version": "1.0",
    "thumbnail_height": 120
}

And similarly for link and rich types.

  1. Which design pattern would be appropriate for the following case?
  2. What is the mandatory fields while providing oEmbed? oEmbed documentation says type and version as mandatory param?
  3. What are the params that can be added in response for each type?

Any suggestions are welcome :-)

Aucun commentaire:

Enregistrer un commentaire