Skip to content

Commit 5a8419e

Browse files
committed
glo03-666: initial commit
1 parent 9732252 commit 5a8419e

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@ Containing examples for the [Confluence REST API](https://developer.atlassian.co
1515
- Linux / Unix Shell
1616
or
1717
- Windows Shell
18-
- Cygwin + curl
18+
- Cygwin + Curl
1919
- Intune-Client or
2020
- https://curl.se/windows/
2121

22+
# How to use it
23+
24+
1. copy the file `common/my.cfg.tpl` to `~/.restapi`
25+
2. rename the file to `~/.restapi\my.cfg`
26+
3. edit the file `~/.restapi/my.cfg`
27+
- set the variables
28+
- `CONF_BASE_URL_*` = URL's of your Confluence instance
29+
- `CONF_PAT_*` = Personal access token for authentication
30+
2231
# Notice
2332

2433
__Examples are working with privat access token (PAT) only!__

browse.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#
88
# (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
99
#
10+
# Call:
11+
# ./browse.sh
12+
#
1013

1114
source ./common/env-restapi.sh
1215

read-children.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#
88
# (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
99
#
10+
# Call:
11+
# ./read-children.sh <PAGE_ID>
12+
#
1013

1114
source ./common/env-restapi.sh
1215

read.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#
88
# (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
99
#
10+
# Call:
11+
# ./read.sh
12+
#
1013

1114
source ./common/env-restapi.sh
1215

upload.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,23 @@
88
# (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
99
#
1010
# - https://confluence.atlassian.com/confkb/using-the-confluence-rest-api-to-upload-an-attachment-to-one-or-more-pages-1014274390.html
11+
#
12+
# Call:
13+
# ./upload.sh <PAGE_ID> <ATTACHMENT_FILE>
14+
#
15+
16+
source ./common/env-restapi.sh
17+
18+
if [ "$1" != "" ]; then
19+
PAGE_ID=$1
20+
fi
1121

12-
source ./env-restapi.sh
22+
if [ "$2" != "" ]; then
23+
ATTACHMENT_FILE=$2
24+
fi
1325

14-
echo -e "\bDo the upload\n"
26+
echo "Do the upload"
27+
echo "Page ID: ${PAGE_ID}"
28+
echo "File: ${ATTACHMENT_FILE}"
1529

16-
curl -s -H "Authorization: Bearer ${CONF_AUTH}" -X POST -H "X-Atlassian-Token: no-check" -F "file=@${ATTACHMENT_FILE}" -F "comment=attached at ${TS}" ${CONF_RESTAPI_URL}/${PAGE_ID}/child/attachment?allowDuplicated=true | jq -r
30+
curl -s -H "${CONF_AUTH}" -X POST -H "X-Atlassian-Token: no-check" -F "file=@${ATTACHMENT_FILE}" -F "comment=attached at ${TS}" ${CONF_RESTAPI_URL}/${PAGE_ID}/child/attachment?allowDuplicated=true | jq -r

0 commit comments

Comments
 (0)