Table of Contents |
---|
You can manage your Confluence shares via web API by generating API Key. To do this, perform the following steps:
Go to External Share for Confluence admin panel and click on API Keys tab. This will send you to 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-
...
modifiable field, shows value of the key.
Reveal - reveals 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.
Delete Shares - determines whether delete 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, time when the key was created.
Last Modification Time - non-modifable field, time when the key was last modified.
Last Usage Time - non-modifable field, time when the key was last used.
Usage Count - non-modifable field, counter that shows how many times the key was used.
Using the Web API with API key
...
Code Block |
---|
Authorization: 'Bearer { KEY_VALUE }' Content-Type: 'application/json' |
With the headers set, you can now perform operations selected from among the following operations: GET, LIST, CREATE, and DELETE.
GET OPERATION
This operation allows you to retrieve a single share based on share uuid. This operation does not accept any additional options and returns JSON with Share data.
...
You may also pass additional fields:
Parameter Name | Description | Default | ||
---|---|---|---|---|
contentType | Type of Confluence content, such as “PAGE“ or “BLOGPOST“ | PAGE | ||
spaceId | ID of the Confluence space (shortens response time if specified) | null | ||
name | Name of the link | External Share Link | ||
showComments | All existing comments will be visible on shared link. | false | ||
allowAddComment | Anyone with access to the link can add comments. | false | ||
showAttachments | All existing attachments will be visible on shared link. | false | ||
allowAddAttachment | Anyone with access to the link can add attachments. | false | ||
allowRemoveUnsupportedMacros | Unsupported macros will be removed from the Share | false | ||
showMacrosPlaceholder | Unsupported macros will be replaced with placeholders. | false | ||
allowShareChildPages | Child pages will be accessible with the same permissions as this parent link | false | ||
showLabels | All page labels will be visible on the Shared Link | false | ||
description | Description of the link. For internal purposes only. | null | ||
expiration | Expiration timestamp in epoch miliseconds. | null | ||
selectedUsersConfig | Pass this object to define list of users that can access the share. You can pass the following fields in this configuration:
| null |
Example Call:
Code Block | ||
---|---|---|
| ||
POST https://confluence.external-share.com/webapi/share { "contentId": "2556174", "contentType": "PAGE", "spaceId": "213516917", "description": "This is internal description - not visible on share", "name": "Name of the link - External Share Link if left empty", "showComments": true, "allowAddComment": false, "showAttachments": true, "selectedUsersConfig": { "allowed": true, "allowedNotification": false, "list": [{"email": "expl@expl2.com"}, {"email": "expl@expl.com"}] } } |
DELETE OPERATION
This operation allows you to delete a single share based on its share uuid. It does not accept any additional options. Upon successful execution, it returns no content (HTTP 204). If an error occurs, a JSON with the error message will be provided.
Example Call:
Code Block |
---|
DELETE https://confluence.external-share.com/webapi/share/{SHARE_UUID} |