More in this section
Forums / Developing with Sitefinity / Adding Related Images to Custom Content Type using Web API

Adding Related Images to Custom Content Type using Web API

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. David
    David avatar
    0 posts
    Registered:
    10 Jan 2017
    28 Jan 2017
    Link to this post

    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?

  2. Tim
    Tim avatar
    2 posts
    Registered:
    19 Feb 2016
    02 Feb 2017 in reply to David
    Link to this post

    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,

  3. David
    David avatar
    0 posts
    Registered:
    21 Dec 2012
    06 Feb 2017 in reply to Tim
    Link to this post
    That was perfect, it really helped to explain what's going on with $ref in the /sfhelp documentation
3 posts, 0 answered