REST API and Blog Posts containing You Tube Video links

REST API and Blog Posts containing You Tube Video links

This question is answered

We are converting a site to use the REST API exclusively. I noticed that we have a published blog post with the You Tube video link in, supplying the height and width eg:

Whenever I query this blog post via the debug console, I see that for some reason the url that is carried is wrapped in an anchor and links back to the blog post detail on the community web site. None of original youtube url or dimension details are available in the REST results.

Is there a different and elegant way to retrieve this information that is a part of the post body?

Thanks,

Aaron

Verified Answer
  • Hi Aaron,

    Youtube videos are embedded via FileViewers, which are not rendered by default within content served from REST.  This is an area we are looking at improving.  However, as a workaround, you can set un undocumented parameter to your REST request, 'PostTarget'.  By default, the target is 'WebServices'.  However, if you pass the value of 'Web' for 'PostTarget', it will format the body the same as it would be when rendered within the widget, including FileViewer content transformations.  

    Please note that as FileViewers currently expect to render within a page hosted within Evolution that there is some potential that some viewers might not work if they have dependencies on other  JavaScript, image, or Flash assets served by Evolution.  However, the YouTube FileViewer is fairly basic and just serves an <embed> tag within the source.

    Hope this helps

All Replies
  • or is it possible i could just use the embed, object, or video tags directly in the post body? seems these get removed...would i be able to allow them by making an exception for these tags inside the communityserver_override.config file with the html sanitization node?

  • Aaron,

    We will have someone respond shortly.

    Thank you

  • Hi Aaron,

    Youtube videos are embedded via FileViewers, which are not rendered by default within content served from REST.  This is an area we are looking at improving.  However, as a workaround, you can set un undocumented parameter to your REST request, 'PostTarget'.  By default, the target is 'WebServices'.  However, if you pass the value of 'Web' for 'PostTarget', it will format the body the same as it would be when rendered within the widget, including FileViewer content transformations.  

    Please note that as FileViewers currently expect to render within a page hosted within Evolution that there is some potential that some viewers might not work if they have dependencies on other  JavaScript, image, or Flash assets served by Evolution.  However, the YouTube FileViewer is fairly basic and just serves an <embed> tag within the source.

    Hope this helps