Adding Related Images to Custom Content Type using Web API - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Adding Related Images to Custom Content Type using Web API

  • Adding Related Images to Custom Content Type using Web API
  • 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?

  • 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,

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