Adding Related Images to Custom Content Type using Web API

Posted by Community Admin on 04-Aug-2018 00:05

Adding Related Images to Custom Content Type using Web API

All Replies

Posted by Community Admin on 28-Jan-2017 00:00

I've created a Module with a Content Type of "Product".

One of the fields on this content type is "Product Images" which is set up to link to Related media, allowing multiple images.

I'm now trying to use the Web Services API to create an integration layer between my website and an enterprise Product Information Management tool. I use the Web Services API because this layer is on a closed SOA integration server - no C# API allowed.

Everything's working beautifully, products are creating properly, images are in Sitefinity (manually created for now until I cross that bridge).

However, the documentation is a little sparse on how to create the relationship between the image and my dynamically created Products.

Let's say that these are the API paths to my objects:

/api/default/images(eb6147e3-5eaa-621e-8ec6-ff68725d7b24)
/api/default/products(a68d47e3-5eaa-621e-8ec6-ff00000d7b17)
/api/default/products(a68d47e3-5eaa-621e-8ec6-ff00000d7b17)/ProductImages (which is currently an empty collection)

How would I construct call (POST, PUT, PATCH) that creates the desired relationship? Am I making a fundamental mistake somewhere?

Posted by Community Admin on 02-Feb-2017 00:00

David,

There's a very good list of sample service calls here. (The one you're looking for is #25 when loaded in Postman.)

Regards,

Posted by Community Admin on 06-Feb-2017 00:00

That was perfect, it really helped to explain what's going on with $ref in the /sfhelp documentation

This thread is closed