Table of Contents
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
When the connection is configured and the URL endpoint and API token are created, you can use the URL endpoint and API token to transfer attachments from the source instance (where the app is installed) to the target cloud instance. You can use these credentials either through Jira automation, or your own app.
Jira automation
...
Table of Contents
Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
When the connection is configured and the URL endpoint and API token are created, you can use the URL endpoint and API token to transfer attachments from the source instance (where the app is installed) to the target cloud instance. You can use these credentials either through Jira automation, or your own app.
Jira automation
Create a Jira automation on the desired trigger (e.g. Issue created) with the “Send web request“ action. Use the generated URL endpoint for the “Web Request URL“. To authenticate your API requests, include an Authorization header in each request. The value of this header should be the API token generated from the API Tokens in the Settings. See the “Send web request“ action example below:
Web request URL
Fill with the generated URL endpoint, e.g.:
https://attachments-transfer-api.twinit.app/gateway/transferAttachments?id=aef469b5-34e5-4e16-942f-d3916d33b6b5
HTTP method
POST
Web request body
Custom data
jql
(string) - (Required): The JQL query to find the target issue.JQL has a limit of 10 issues per automation action!
sourceKey
(string) - (Required): The key of the source issue.commentId
(string) - (Optional): The ID of the comment (if applicable):If the commentId is included, only the attachments related to the specific comment will be sent. If the commentId is absent, all the issue attachments will be transferred.
You can use the {{issue.comment.last.id}} smart value to send the attachments attached to the last comment on the issue. If you need to send the attachment attached to the specific comment(s), use the specific commentId value(s) of the commentId instead of the smart value.
If the {{issue.comment.last.id}} smart value is added, you can also decide whether to create a comment (with the attachments links) or not. By default, the comment will be created on the target instance with the attachment links. If you don’t want to create a comment on the target instance, add
createAsComment: false
in the request body.
...
Note |
---|
If several attachments are sent to several objects, depending on the number and size of the attachments, the automation log may return “Response 408 SocketException: Socket closed”. However, this might be a false error and the attachments will be sent to the objects. |
...
Code Block |
---|
{ "jql": "issuekey = ITSM-1", "sourceKey": "ITSM-15", "commentId": "12345" } |
curl example
Code Block |
---|
curl --request POST \ --url 'https://attachments-transfer-api.twinit.app/gateway/transferAttachments?id=aef469b5-34e5-4e16-942f-d3916d33b6b5 ' --header 'Accept: application/json' \ --header 'Authorization: 46f61f78-e138-4019-85a0-e239878f2c94' --data ' { "jql": "issuekey = ITSM-1", "sourceKey": "ITSM-15", "commentId": "12345" }' "sourceKey": "ITSM-15", "commentId": "12345" }' |
Audit log
You can track all the requests in the Audit Log. To access the log, click the Audit log button on the “URL Endpoint” section of the settings:
...
Clicking the button will navigate you to the audit lot that shows the list of the requests:
...
Info |
---|
The audit log shows the request history for the last two months! |
A maximum of 20 log entries will be shown per single page.
You can filter the log by:
Period
Anytime (shows all the available logs)
Today
Last 3 days
Last 7 days
Custom (select starting and the end dates)
Status
All (shows request with all the statuses)
Success (shows successful requests)
Error (shows failed requests)
You can also search the entries by a search term. The field searched the entries by the URL endpoint name and Audit log ID.
After selecting the filters, click the “Search“ button to filter the log entries based on the selection.
For the request entries, the grid shows the following information:
Date & time
When the request was sent
Audit log ID
ID (order number) of the entry
URL Endpoint
To which URL Endpoint the request was sent
Status
Success or Error
Operations
Clicking “Show more“ or anywhere on the entry row will expand the log details:
...
Info |
---|
Updating the log may take some seconds after the request is sent. To retrieve the logs immediately, click the refresh button: |