Hello,
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 & "--" & _
STR_BOUNDARY & "--"
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
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
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Regards
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.
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.
Regards,
Elena Ovdienko
Product Manager@Stiltsoft
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Stiltsoft Support thank you for your quick answer - but are those distinctions available via any type of API in cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
These are the basic features of our app. No need to configure anything after setting up.
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.