Hello, experts:
I was looking for several questions, but I found no answer.
I'm making a third party app, using the REST API of Jira Cloud, just to show an issue and all its information. Yes, I was able to get all the issue information, even description and attachment list, also, I was able to get the comments list from another part of the API, and also, I was able to get the attachment info from the attachment queries from the attachment API part.
But the problem is this: in the description field, both the comments and the isssue's, there is a "block" called "media", that refers to a file. That file is attached to the issue, for sure. Ok, no problem, I have info of both.
The problem is, the "media" block only has an ID field that match to the "mediaApiFileId" field on the attachment... but this field is blank in all of the issue's attachments. I don't have the ID on the "media" comment block, nor the "mediaApiFileId" in the attachment data.
How do I suposse to know what attachment should I show if there is no link between them? I don't care if I have to make 3 or 4 calls to the API, but I don't know WHAT CALLS should I do.
I tried using renderedFields option too, but it returns a relative path, and I get no information about the absolute http address I should call either.
For now, what I did was to ask for the comment to be rendered in html format. Then, using Html Agility Pack, navigate to the <img> tag and get the attachment URL path from the src attribute.
It looks like "/secure/attachment/23829/23829_image-20211027-073633.png". So, splitting the string with "/" character, I look at the second last string ("23829" in this case). That is the attachment ID.
Because I previously downloaded all the issue's attachment metadata, I only had to look for that ID in the list, and then call to Jira API to download it (I can get the preview from the attachment metadata, but not the image itself, because it needs the token in the header).
I am no software engineer but I am wondering if these might help you
Add an attachment (maybe the syntax can help you out)
HTH,
KGM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but no. As I said, I already read the official doc. I was able to read issues, attachments and comments from the API, but there is no connection between them.
The "Add an attachment" don't help either, because I don't want to save, and the way you add an attachment has nothing to do the way you read them.
So still stuck at the same point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.