How to manage attachments with public Java API
This section of our documentation refers to the public Java API available in Smart Attachments for Jira. Java API is available starting from Smart Attachments for Jira 2.1.0.
Please, note that Java API methods are not exposed in Smart Attachments versions older than 2.1.0. For older versions of the app, use REST API instead.
In this section, you will find examples of the most common cases of usage of the public Java API available in Smart Attachments for Jira. If you need the whole Java API documentation for the app, click the button below.
Please note that we provide this public Java API to solve use cases not included in the app functionality available. Our support doesn't include help in writing scripts with the app public Java API. Our Support Team may assist with particular requests regarding writing scripts at our sole consent.
Create a new category scheme with categories
This example illustrates creating a new category scheme with a pre-defined set of categories.
Update the configuration of the category scheme
This example illustrates the way to update the configuration of the category scheme (issue type visibility, access restrictions. auto-distribution rules).
Associate the category scheme with the project
This example illustrates the way to associate the project to the specific category scheme.
Deassociatу the category scheme from the project
This example illustrates the way to remove the association of the project to the specific category scheme.
Move attachments between categories
This example illustrates moving attachments from one category to another within the same issue.
Copy an issue with attachments in categories
This example illustrates the way to copy an issue with attachments and preserve attachments in their categories.
Copy an issue with attachments in categories to another project
This example illustrates the way to copy an issue with attachments in categories to another project with preserving files in categories as in the source issue.
This script will work only in projects that are associated with the same scheme.
Check for the presence of attachments in a certain category depending on the custom field value
This example illustrates how to check for the presence of attachments in a certain category depending on the custom field value.
Get the attachment comment information
The attachment commenting feature has been deprecated in Smart Attachments 2.15.2.
This example illustrates how to get the information about the attachment comments (including the author, comment text, and creation time).
Get the list of projects with Smart Attachments for Jira
This example illustrates getting information about the Jira projects with the Smart Attachments category scheme activated. The result will bring you the list of all projects in your instance, including the archived ones where the category scheme has been activated.
Copy all the attachments from one issue and add them to a linked issue
This example illustrates copying all the attachments from one issue and adding them to a linked issue with preserving the attachment category and revisions.
Please note that this script has two variables. These are "TD-1" and "TD-6". You will need to replace these values with the following issue keys from your Jira projects:
use the issue key of the source issue (from which you are copying) instead of "TD-1"
use the issue key of the target issue (to which you are copying) instead of "TD-6"
- Create a new category scheme with categories
- Update the configuration of the category scheme
- Associate the category scheme with the project
- Deassociatу the category scheme from the project
- Move attachments between categories
- Copy an issue with attachments in categories
- Copy an issue with attachments in categories to another project
- Check for the presence of attachments in a certain category depending on the custom field value
- Get the attachment comment information
- Get the list of projects with Smart Attachments for Jira
- Copy all the attachments from one issue and add them to a linked issue