Pranavi
Pranavi

Reputation: 1

Getting images from same page as the content (link between /attachments and the page it is from) XWiki REST API

Right now I am getting content from base/spaces/abc/pages/xyz which has data['id'] from response of 'base:abc.xyz' and the image from base/spaces/abc/pages/xyz/attachments where i do

        for each in data['attachments']:
             category = each['id']

which has category of 'base:[email protected]'... how do I link these together right now so that when i get a page I can find the images in that page

right now I am doing

match = re.match(r'(.*?)(?<!\\)@', category)
      if match:
          category = match.group(1) # to get category of 'base:abc.xyz

so that the image has the same id as the id of the page it is in and then find both.

BUT i am worried this is hardcoded, is it always the case that @ WITHOUT @ separates the filetype and the parent id of the page OR is this not standard and it was just the way this specific xwiki was configured?

Upvotes: 0

Views: 14

Answers (0)

Related Questions