Populate other properties with a property

390 views Asked by At

I have very recently been assigned to an EPiServer project. I'm .Net developer however, I had never had a pleasure of actually working with ES.

I have been given a task of creating a soft "integration" with SoundCloud. Our users would like to copy/paste URL to a SoundCloud song - which then I can use their API to actually get all information of the audio. (title, description, tags etc).

So what I have created so far

  • SoundcloudPageType (contains simple properties like title, description, duration etc.)
  • I have written little POC for Soundcloud API that gets me all information and deserializes it into object.

What I need now is a bridge between those two. I thought that creating something like "PageLinkReference" where you can click [...] button which would then ask you for "URL to SoundCloud audio", once person enters that I would do a REST api call to pre-populate all other properties on the page.

Now, this is just an idea. I would like to run it past you guys to see if

  1. It is possible.
  2. What is the best way of doing this and are there any tutorials that do something similar.

I do not want to hack and slash my way through EPiServer but to utilise what EPiServer might already provide.

2

There are 2 answers

5
Johan Kronberg On BEST ANSWER

I would add a short string property to the SoundcloudPageType and let the users paste into that field.

If you are using PageTypeBuilder something like this:

[PageTypeProperty(
        EditCaption = "Soundcloud Url",
        Type = typeof(PropertyString),
        SortOrder = 2010,
        UniqueValuePerLanguage = false,
        Searchable = true)]
public virtual string SoundcloudUrl { get; set; }

Then you could either fetch "on request" or fetch and store (easiest on other properties you've added) in one of EPi's save events. Take a look at Joel's article of common patterns when integrating with EPi:

http://joelabrahamsson.com/episerver-integration-patterns/

1
tompipe On

You could use the oEmbed dynamic content plugin, which should support soundcloud

http://nuget.episerver.com/en/?search=oembed&sort=MostDownloads&page=1&pageSize=10