Using the new Asset Service when exporting resources in iPMC

Hi!

When creating an integration that will export resources (images/documents) to other systems from inRiver Product Marketing Cloud (iPMC) you have a lot of different options on how to do this.

For example:
  1. Going with the old fashioned, creating files on disk using iRIS (inRiver Remote Integration Service).
  2. Placing the data on a cloud drive, like an FTP or Amazon S3 bucket. Then the target system will have to read the file from there.
  3. Sending the actual data of the resource directly to the target system. Either by base64-encoding the byte-array to send it as normal post-call or creating a multipart form post.

There are several downsides to the above mentioned ways of sending resource data:
  1. Creating files on disk requires you to have an actual server somewhere that you need to pay for and take care of. If you can co-host iRIS on the same machine as the target system, that covers the costs initially but you may end up needing to increase the performance on the server.
  2. Cloud drives are usually quite affordable but it is still an extra cost and another thing that you have to keep maintained (enough disk space and so on).
  3. Sending the data directly is fine if you have few updates, few resources or very small files. Otherwise this may very fast turn into a bottleneck when you have to wait for the data to be transferred. This also affects point 2. Now you might be thinking that you want to create a separate thread to send the data in but there isn't any multi-thread support when creating extensions in iPMC right now. 

So what is the preferred way? Sending a URL to the target system where it can fetch the resource! Then the target system can download the resource whenever it sees fit. If the target system has the capability it can also download several of them at the same time without affecting performance on the connector. 

This has always been an option in iPMC using xConnect. You can publish all the resouces in the system to xConnect and then use the public URLs for the resources. Previously this has only been possible if the customer have xConnect in their inRiver PIM license and also configured the resources to be available in xConnect. However, with the new inRiver Asset Service - introduced in the February 2018 update of iPMC - all resources get a public URL without the need for xConnect. 


Doing this is very simple using the new MainPictureUrl property. This property is available on each entity. The name is self-explanatory; when using the property, you get the URL for the resource that is set as Main Picture. For a resource entity it is the file itself, for any other entity it is the first linked resource. So for example if you want a list of URLs for all the directly connected resources for your product you can simply do like this:
var resourceUrls = productEntity.Links
      .Where(link => string.Equals(link.LinkType.Id, "ProductResource"))
      .Select(link => link.Target.MainPictureUrl);

You can also append the name of any of the definied Image Configurations to the URL and get the image resized. So go ahead and and start using the new Asset Service and if you have any other ideas on how you would handle these kinds of integrations reach out to me!
/Peter

Comments

  1. Nice blog! Thanks for providing about this Rich text editor JavaScript it is very useful to us.

    ReplyDelete
    Replies
    1. Thanks John! Glad you enjoy it and could put some things to good use. I just have to get some time to write some new posts. ;-)

      Delete

Post a Comment

Popular Posts