Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can manage your Confluence shares via web API by generating API Key. To do this, perform the following steps:

  1. 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.

    Image Modified
  2. Click on Create new API key. API key creation popup will appear.

...

  1. Image Added

    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.

...

Parameter Name

Description

Default

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. showComments has to be set to true.

false

showAttachments

All existing attachments will be visible on shared link.

false

allowAddAttachment

Anyone with access to the link can add attachments. showAttachments has to be set to true.

false

allowRemoveUnsupportedMacros

Unsupported macros will be removed from the Share

false

showMacrosPlaceholder

Unsupported macros will be replaced with placeholders. allowRemoveUnsupportedMacros has to be set to true

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:

  1. allowed - set to true if you want to allow access only to selected users.

  2. allowedNotification - if true, users will be notified via e-mail when added to the list

  3. list - list of e-mails that may access the share. Refer to example below to see how to correctly pass the e-mails.

Code Block
"selectedUsersConfig": {
		"allowed": true,
		"allowedNotification": false, 
		"list": [{"email": "expl@expl2.com"}, {"email": "expl@expl.com"}]
	}

null

Example Call:

Code Block
languagejson
POST https://confluence.external-share.com/webapi/share
{
	"contentId": "2556174",
	"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://jira.external-share.com/webapi/share/{ SHARE_UUID }