I am writing a Confluence page from Python code, uploading the page contents via the Restful API. Everything works fine, except when I am trying to create an image thumbnail (i.e. what you get when you insert an attached image into a page, you get a preview of it and you can click to enlarge).
To do this, I just copied the html code generated by creating such a thumbnail, and I am recreating the same thing in my code. I get the thumbnail to appear, but it’s not clickable.
Below is how I build the html string I then upload to the page. You can trust that all of my variables here have correct values. I have a few questions:
- Do you spot any stupid mistakes?
- I was able to figure out how to fill all the various parameters, except the “modificationDate”. This seems to be in a weird format that I don’t understand how to build. Any clues there?
content += "<p><span class='confluence-embedded-file-wrapper confluence-embedded-manual-size'>" content += "<img class='confluence-embedded-image confluence-thumbnail' " content += "height='%s' " % height content += "src='/download/thumbnails/%s/%s?" % (pageID, attachmentName) content += "version=%s&modificationDate=1576227457920&api=v2' " % attachmentVersion # modificationDate? content += "data-image-src='/download/attachments/%s/%s?" % (pageID, attachmentName) content += "version=%s&modificationDate=1576227457920&api=v2' " % attachmentVersion # modificationDate? content += "data-unresolved-comment-count='0' " content += "data-linked-resource-id='%s' " % attachmentID content += "data-linked-resource-version='%s' " % attachmentVersion content += "data-linked-resource-type='attachment' " content += "data-linked-resource-default-alias='%s' " % attachmentName content += "data-base-url='%s' " % self.baseUrl content += "data-linked-resource-content-type='%s' " % contentType content += "data-linked-resource-container-id='%s' " % pageID content += "data-linked-resource-container-version='%s'>" % pageVersion content += "</img></span></p>"