You can manage your Jira shares via web API by generating API Key. To do this, perform the following steps:
Go to the External Share for Jira admin panel and click on the API Keys tab. This will send you to a screen with all previously generated keys.
Click on Create new API key. API key creation popup will appear.
Setup your API key and copy or download it. The template has the following fields:
Key Name - provide your own name for the API key, up to 40 characters long.
Key Value - non-modifable field, shows the value of the key.
Reveal - reveals the key. This is NOT one time operation - you can reveal the key at any time.
Download - downloads the key to the selected location.
Get Shares - determines whether get operation is allowed for the key.
List Shares - determines whether list operation is allowed for the key.
Create Shares - determines whether create operation is allowed for the key.
Not valid before - set the start date for key validity.
Not valid after - set the invalidation date for the key.
Allowed IPs - set IPs or IP range that can use the key.
Description - description of the key. Maximum 4000 characters.
Creation Time - non-modifable field, the time when the key was created.
Last Modification Time - non-modifable field, the time when the key was last modified.
Last Usage Time - non-modifable field, the time when the key was last used.
Usage Count - non-modifable field, counter that shows how many times the key was used.
...
With key generated, you can now make a call to Web API. First of all, set Authorization and Content-Type headers in your REST client.
...
This operation allows you to retrieve a sorted list of shares based on the options passed. You need to have an access to shared issues to be able to list shares. You can pass the following options as request parameters:
sort - share field by which the list will be sorted. The default value is “id”. In general, you can sort by any Share’s field as long as it is in a snake_case instead of camelCase. For example, you can sort by Issue ID, by passing “issue_id” (instead of issueId as returned in the JSON).
sortOrder - order in which list will be sorted. Pass “asc” for ascending list; “desc” for descending list. “asc” is default.
limit - defines how many shares will be returned in a single call. Default is 100.
offset - defines how many positions from the start of the list will be ommited. Combined with the limit parameter, this parameter may be helpful in performing help perform concurrent calls. The default value is 0, which means the very first share on the list will be returned.
userId - returns all shares for a given user ID.
projectId - returns all shares in the selected project.
...
Parameter Name | Description | Default |
---|---|---|
password | Sets password for share. | null |
expiration | Expiration timestamp in epoch miliseconds. | null |
showComments | All existing comments will be visible on the shared link. | true |
allowAddComment | Anyone with access to the link can add comments. | false |
showInternalComments | Anyone with access to the link can view internal comments. | false |
allowAddInternalComment | Anyone with access to the link can addinternal comments. | false |
showAttachments | All existing attachments will be visible on the shared link. | true |
allowAddAttachment | Anyone with access to the link can add attachments. | false |
allowAddPublicAttachment | Anyone with access to the link can create a public comment with an attachment. | false |
showSubtasks | Information about subtasks will be visible on the link. | true |
showLinkedIssues | Information about linked issues will be visible on the link. | true |
shareSubtasksContent | Information about subtasks will be visible on the link as per share settings. | false |
shareLinkedIssuesContent | Information about linked issues will be visible on the link as per share settings. | false |
allowWorkflowTransition | Anyone with access to the link can change its status. | false |
showWorklog | Anyone with access to the link can see the worklog. | false |
showChangelog | Anyone with access to the link can see history items from the changelog. | false |
customFields | Array An array of objects with Custom Field ids that will be available on the link. Example: [{"id":"10020"}, {"id":"10021"}] Refer to the Jira API documentation to retrieve Custom Fields ids: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/ | null |
allowExternalUsers | Set to true to allow link to be opened only by a selection of users. Users should be defined in ‘external users' parameter. | false |
allowExternalUsersNotification | Set to true to send an e-mail notification to all users defined in the ‘externalUsers’ parameter. Requires ‘allowExternalUsers’ and ‘externalUsers’ parameters to be set. | false |
externalUsers | E-mails of external users allowed to view the link’s content. Example: [“xyz@xyz.com, “zyx@zyx@com]. ‘allowExternalUsers’ have to be set to true or this parameter will be ignored. | null |
...
Code Block |
---|
POST https://jira.external-share.com/webapi/share { "issueId": "10001", "type": "ISSUE", "expiration": 1649700933954, "customFields": [{"id":"10020"}, {"id":"10021"}], "allowExternalUsers": true, "externalUsers": ["expl@expl2.com", "expl@expl.com"] } |
An example rule: Automatically create an External Share link for every new issue.