2.4 Open Rest Api

2.4.1 Query all attachment download history

Desctiprion: Get all exist attachment download history at once.

Url: {Confluence_BaseUrl}/rest/attachmentListener/latest/downloadHistory/queryAllDownload

Method: GET

Auth: Basic Auth (Use Confluence user's username and password)

Response:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [ { "id": 5, "downloadDate": "2021-01-23 11:05:38", "userName": "userName 10", "userKey": "admin", "spaceKey": "ds", "spaceName": "Demonstration Space", "pageId": 65546, "pageName": "spaceName 82389", "attachmentId": 0, "attachmentName": "Attachment Name2A", "url": "http://localhost:1990/confluence/ds/65546" }, { "id": 23, "downloadDate": "2021-01-23 12:22:13", "userName": "Poppy", "userKey": "1", "spaceKey": "123", "spaceName": "spaceName 12345", "pageId": 82389, "pageName": "spaceName 82389", "attachmentId": 82389, "attachmentName": "Attachment Name2A", "url": "http://localhost:1990/confluence/ds/65546" } ]

2.4.2 Add attachment download history

Description: This plug-in does not monitor the attachment download behavior implemented by other plug-ins. You can add attachment download history by yourself through this API.

Url: {Confluence_BaseUrl}/rest/attachmentListener/latest/downloadHistory/addRecord

Method: POST

Auth: Basic Auth (Use Confluence user's username and password)

Body demo:    

1 2 3 4 5 6 7 8 9 10 11 { "userKey": "1", "userName": "Poppy", "spaceKey": "123", "spaceName": "spaceName 12345", "pageId": "82389", "pageName": "spaceName 82389", "attachmentId": "82389", "attachmentName": "Attachment Name2A", "url": "http://localhost:1990/confluence/ds/65546" }

Body field description:

Field

Type

Required

Display on the page

Description

Field

Type

Required

Display on the page

Description

userKey

String

optional

hidden

User key, max length is 255

userName

String

optional

display

Username, max length is 255

spaceKey

String

optional

hidden

Space key, max length is 255

spaceName

String

optional

display

Space name, max length is 255

pageId

long

optional

hidden

Page ID

pageName

String

optional

display

Page name

attachmentId

long

optional

hidden

Attachment ID

attachmentName

String

required

display

Attachment name

url

String

optional

display

Attachment url

Response:

Status code

Response message

Description

Status code

Response message

Description

200

{
    "msg": "ok"
}

Add successfully.

400

 

Bad request, check param form or requirement.

401

Administrator permission is required.

No permission, administrator permission is required.

500

Fail to add record. Please check the log.

Fail to add record. Please check your param length, or check the log.

500

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>...

Make sure your JSON data in request body is correct. Check the message responsed.