5

I have implemented the ECL connector for SDL media manager. Components are coming properly on the CMS end.

On component save I have implemented an event system code for the ecl component which is used to copy the data of the external metadata to metadata.

Now I want to pass the preview url(Resolved) of the image to the metadata also.

Is it possible to access the preview url(Resolved) of the image from my event system code?

for Example - https://abc.dist.sdlmedia.com/Distributions/?o=73026DA3-0FD0-4571-84C5-A0DF4666709F - This is the distribution url.

Now once I hit the url on browser, this url get resolved and provide the below url - https://abc.ssl.cdn.sdlmedia.com/image/635699714447784833LE.jpg

I need the second url in Tridion component for profiling.

  • could you add the code you are using to your question, and specify what is not working : do you get an error message, the wrong value, or no value of the preview url ? – Harald Hoffelinck Mar 31 '15 at 11:50
  • I am not able to access the preview url of that image from my code. Please suggest – Sayantan Basu Mar 31 '15 at 12:10
  • It is not clear to me what you mean with "preview url(Resolved)". ECL deals with multiple URLs, but not any I would call "preview". – Lars Møllebjerg Jun 22 '15 at 12:11
4

ECL will only give you the first distribution link. It is an internal implementation detail of MM that this link is resolved into the cdn link - something we do not want to expose through ECL (and the connector to Media Manager) as this would mean any change to the implementation of MM would require a new connector to be released and installed.

There is however nothing stopping you from simply making an HTTP connection to the distribution URL and see what response you get - I have not tried, but it's probably just a redirect - allowing you to read the "resolved" URL out of the response.

2

Alternative you can ask the MM API for the right URL. For you to be able to communicate with this API you need to have the MM Certificate installed, and a connection setup through: Windows Identity Foundation; http://www.microsoft.com/en-us/download/details.aspx?id=17331

private static string recievePreviewurlFromDistribution(Guid guid) {
    DistributionData distributionData = _mediaManager.GetDistributionByGlobalId(guid);
    AssetData assets = (AssetData)_mediaManager.GetItem(ItemTypes.Asset, distributionData.ProgramIds.FirstOrDefault());

    return assets != null ? assets.PreviewUrl : null;
}
1

I have found a work around for that -

I have created a method to resolve the CDN url from my event system code.

Here is the Code -

WebRequest webRequest = WebRequest.Create(cdnurl);
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
var resolvedUrl = response.ResponseUri.AbsoluteUri;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.