How to manage attachments via REST API
REST API methods are not available in Smart Attachments 2.X+ versions. Please use Java API instead.
Fetching categories with attachments within the issue
You can get the list of categories with attachments for the specific JIRA issue.
The pattern of request looks like this:
In this request you need to enter the correct value for the following parameter:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue which you want to see the list of categories with attachments. |
Here you can see an example of the request:
As a response, you will receive the following JSON string:
Moving attachments from one category to another
You can move one or multiple attachments from one to another category of the same issue.
The pattern of request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue for moving attachments. |
toCatId | ID of the category which attachments are moved to. |
attachments | ID's of attachments you want to move. |
Here you can see an example of the request:
No response is returned.
Sending attachments to email
You can send one or multiple attachments to one or multiple email recipients. The add-on API allows you to optionally specify email address using CC and BCC fields.
The pattern of request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue which attachments you want to send to email. |
subject | Email subject. |
message | Email message. |
ids | ID's of attachments you want to email. |
to | Email address of the person who you send attachments to.Use ', ' (comma with space) to enter multiple emails. |
cc | CC (carbon copy) email address which you want to send the attachments to. Use ', ' (comma with space) to enter multiple emails. |
bcc | BCC (blind carbon copy) email address which you want to send the attachments to. Use ', ' (comma with space) to enter multiple emails. |
sendWithoutAttachments | Allows you to send an email without attachments when there are no attachments with the specified ID's. It may accept two values:
|
Here you can see an example of the request:
No response is returned.
Renaming Attachments
You can rename the attachments in JIRA issues.
The pattern of request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue which attachments you want to rename. |
id | ID of the attachment you want to rename. Omit this parameter if you want to rename a specific document but not a specific attachment. |
catId | ID of the category where the attachment for renaming is stored. |
name | A new name for the attachment. |
documentId | Use it instead of 'id' when you want to rename the document instead of a specific attachment. This parameter is optional and you can omit it if you are performing a request for a specific attachment. For the details on documents with revisions, please see this. |
Here you can see an example of the request:
No response is returned.
Deleting attachments from the category of the same issue
You can delete one or multiple attachments from the issue.
The pattern of request looks like this:
In this request you need to enter the correct value for the following parameter:
Parameter | Description |
---|---|
ids | ID's of attachments you want to delete. |
issueKey | Key of the JIRA issue which attachments you want to delete from. |
Here you can see an example of the request:
No response is returned.
Deleting document revisions
Please note that the whole document with all its revisions will be removed when you specify ID of any revision of this document.
You can delete one or multiple document revisions from the issue.
The pattern of request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue which you want to delete document revisions from. |
id | ID of document/attachment you want to delete with all its revisions. |
Here you can see an example of the request:
No response is returned.
Archiving attachments
You can archive one or multiple attachments stored within your issue.
The pattern of the request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue which you want to see the list of categories with attachments. |
ids | ID's of attachments and document revisions you want to archive. |
docIds | ID's of documents you want to archive. |
cat | ID of the category where you want to place the archive with attachments. |
name | Name of the archive. The ZIP extension will be automatically appended to the archive name. |
Here you can see an example of the request:
Putting attachments to categories before upload
Attachments will be placed to the specific attachment category only when the user who has run this request and then uploaded attachments was the same user.
You can map attachments to the specific category by their file name before files are actually uploaded to the issue.
The pattern of the request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issueKey | Key of the JIRA issue. |
issueId | ID of the JIRA issue (it's optional) |
tempAttachments | The names of the attachments in JSON format "[{"name":"your attachment name","categoryId": "your category ID"}]" that should be placed to specific categories once uploaded. |
Here you can see an example of the request:
Getting attachment metadata
You can get metadata for specific attachments.
The pattern of the request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
attachmentId | ID of the attachment which you want to get metadata for. |
Here you can see an example of the request:
As a response, you will get a JSON string:
AttachmentMetadata
Name | Type |
---|---|
attachmentId | long |
values | JSON string |
Metadata
Name | Type |
---|---|
name | FieldName |
value | String(255) |
FieldName
Supported values for FieldName
Name | Allowed value |
---|---|
documentId | String(255) |
decription | String(255) |
revision | String(255) |
status | StatusCode |
link | String(255) |
signedBy | String(255) |
StatusCode
Status | Code |
---|---|
Draft | 1 |
In Progress | 2 |
In Review | 3 |
Rejected | 4 |
Approved | 5 |
Published | 6 |
Signed | 7 |
Getting metadata for all attachments from the issue
You can get metadata for all attachments within a specific issue.
The pattern of the request looks like this:
In this request you need to specify the correct values for the following parameters:
Parameter | Description |
---|---|
issuesId | ID of the attachment which you want to get metadata for. |
Here you can see an example of the request:
As a response, you will get a JSON string:
Updating metadata for attachments
You can update metadata of a specific attachment. To remove the entire metadata for an attachment, just submit a request with empty values.
The pattern of the request looks like this:
Request headers
Header name | Value |
---|---|
Content-Type | application/json |
Request payload should be a JSON string, as follows:
- Subscribe to receive notifications about changes in REST API of Smart Attachments
- Fetching categories with attachments within the issue
- Moving attachments from one category to another
- Sending attachments to email
- Renaming Attachments
- Deleting attachments from the category of the same issue
- Deleting document revisions
- Archiving attachments
- Putting attachments to categories before upload
- Getting attachment metadata
- Getting metadata for all attachments from the issue
- Updating metadata for attachments