Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Smart Attachments - Add attachment to category via API


I am using Smart Attachments to group my Issues attachments into categories.

Now i need to add attachment to my Issue defining particular category of this Attachment via rest API. Is it possible? Below my siple code to add attachment. How should i modify that to be able to specify category? 

Your answers dont need to be in VBA, Just give me idea how to specify the category please.


Public Function testAuthen()
Dim JiraService As New MSXML2.XMLHTTP60

Dim sFileDataStr As String
sPath = "C:\Users\user1\Desktop\filename.pdf"
Const STR_BOUNDARY As String = "abc123-xyz123"

sFileDataStr = "--" & STR_BOUNDARY & vbCrLf & _
"Content-Disposition: form-data; name=""file"";Filename = """ & Mid$(sPath, InStrRev(sPath, "\") + 1) & """" & vbCrLf & _
"Content-Type: application/octet-stream" & vbCrLf & _
vbCrLf & GetFileBytes(sPath) & vbCrLf & "--" & _

With JiraService

.Open "POST", "myurl/rest/api/2/issue/CERT-63/attachments", False

.setRequestHeader "X-Atlassian-Token:", "no-check"
.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & STR_BOUNDARY
.setRequestHeader "Authorization", "Basic " & UserPassBase64
.send stringToByteArray(sFileDataStr)
MsgBox JiraService.Status
MsgBox JiraService.responseText

End With
End Function


3 answers

@Mohamed Benziane

Thanks for your reply, but it doesn't resolve my problem.

I need to add Attachment to Issue into particular category. 

I dont want manage attachment categories.


I know how to add attachment via API, but i dont know where i can specify category in wchich this new attachment should be attached. 

Hello @Rafał Nowakowski

To add an attachment in a category you have to know its ID (you can follow what i said above)

you can may be try to Put attachments to categories before upload



Hello, I am trying to put attachment to catergory before upload.I am using SoapUI to achieve that, but I am getting 500 error code and "unrecognized character escape 'U'" as error message. Attached is the screenshot of the same.  What might be the reason for that? attachment_2.JPG

0 votes

Hello Rafal

Yes you can add attachment in a specify category, you need to fetch category id, here the code:

curl -D- -u username:password --request GET "JIRA.baseUrl/rest/attach-cat/1.0/project/category?projectKey=PROJECT_KEY"

When you will be able to get the category id here the code to put you're attachment in the category

curl -D- -u username:password --request POST "JIRA.baseURL/rest/attach-cat/1.0/project/category" --data "projectKey=KEY&name=CategoryName&groups=groupName&users=username&roles=roleId&issueTypes=IssutTypeId" 

Here the required field:

projectkey, name, groups,users,roles,issuetypes


Everything is explained here


Sorry for my english


Hope this helps


Hello Rafal,


To add attachment to a specify category you have to get this ID and to fetch id category of a existing project here the code:


curl -D- -u username:password --request GET "JIRA.baseUrl/rest/attach-cat/1.0/project/category?projectKey=PROJECT_KEY"


You will receive a JSON document like this:

{   "categories":[      {         "id":0,         "name":"Uncategorized",         "position":0,         "groups":[],         "roles":[],         "issueTypes":[],         "users":[],         "userPosition":{}      },      {         "id":1,         "name":"Docs",         "position":1,         "groups":["jira-administrators"],         "roles":[10002],         "issueTypes":[10000],         "users":["admin"],         "userPosition":{}      }   ],   "disabled":false,   "imageSize":100,   "formDropZones":true}

Here more informations

 Sorry for my english

Hope this helps


@Florian Reichl 

You can group your attachments into different categories by label, uploader, or upload date using our Smart Attachments for Jira Cloud.

Please, see the documentation for more details.


Elena Ovdienko

Product Manager@Stiltsoft

@Elena Ovdienko _Stiltsoft_  thank you for your quick answer - but are those distinctions available via any type of API in cloud?

These are the basic features of our app. No need to configure anything after setting up.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you