Forum Discussion

apaskett's avatar
apaskett
Contributor
11 years ago

Image and message association error in REST API

We've created an image feed on our Community home page which leverages the REST API, to pull all community images (rest("images?sort_by=date&page_size=${pageSize}&page=${pageNumber}").image_associations)

We ran into an issue today, where an image was being pulled, but the associated message did not exist. Because the message doesn't exist, it's throwing an error in the endpoint which causes the component to not load any images.

 

  1. Why is the image still showing up in this feed when the message it was posted in is no longer accessible?
  2. Is there a way to delete posts in a way for images not to appear in this feed?
  3. We're having difficulty finding information about the original message since all we have is the message ID - no indication of which discussion style, board/category, user or time this message is associated and no way to diagnose the issue. Is there a way to search for a message across the entire community by just the message id?

 

Thanks for your help!

  • MoniqueL's avatar
    MoniqueL
    Lithium Alumni (Retired)

    apaskett wrote:
    ...
    1. Why is the image still showing up in this feed when the message it was posted in is no longer accessible?

    I imagine this is hapening because although a message with that image has been deleted, the image still exisits within the community, if that user uploaded the image via their image gallery, e.g. <community.com>/t5/media/gallerypage/user-id/<id#>

     

    As for 2. and 3, I'm hoping one of our other egineers can chime in on a way to code for this.

    • apaskett's avatar
      apaskett
      Contributor

      We were under the impression (as stated in the docs here: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Community.images#Community.images) that the only images returned in this call would be ones associated with valid messages within the community. In our case, we're making this call against the community as a whole, so we're expecting to get back images from all blogs, discussions, tkb articles, etc etc, but not user-uploaded images (also as stated in the docs).

       

      So basically, regardless of whether the image was uploaded to a user's album and then attached to a message or if it was uploaded when the message was first created, we'd expect that images that aren't associated with a message not to show up in this list. Or is this incorrect?

      • SuzieH's avatar
        SuzieH
        Khoros Alumni (Retired)

        I had a short chat with one of our engineers with regard to your last paragraph:

         

        "So basically, regardless of whether the image was uploaded to a user's album and then attached to a message or if it was uploaded when the message was first created, we'd expect that images that aren't associated with a message not to show up in this list. Or is this incorrect?"

         

        He believes that you've found a bug and asked that you file a ticket with support.