Skip to content

Commit ea7ef87

Browse files
authored
Merge pull request #2 from ftravaglia/get-html-page
Get html page feature
2 parents dda4145 + fbf316e commit ea7ef87

14 files changed

+71
-11
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ The page text should be formatted with HTML tags.
6161

6262
![screenshot of add-page](images/updatepage.png)
6363

64+
65+
### Task: Get HTML content
66+
67+
Get the HTML code of a confluence page.
68+
69+
![screenshot of get-html](images/get-html-page.png)
70+
71+
6472
### Server configuration ###
6573

6674
![screenshot of configuration](images/config.png)

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
id "java"
66
}
77

8-
version = "1.1.0"
8+
version = "1.2.0"
99

1010
processResources.configure {
1111
filter ReplaceTokens, tokens: [

images/get-html-page.png

62.3 KB
Loading

src/main/resources/confluence/ConfluenceClient.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#
@@ -90,6 +90,25 @@ def getPageIdsByTitle(self, spaceKey, pageTitles):
9090
pageIdList.append(page['id'])
9191
return pageIdList
9292

93+
def getPageHtmlByTitle(self, spaceKey, pageTitles):
94+
print "Executing getPageHtmlByTitle() in ConfluenceClient\n"
95+
pageID = self.getPageIdsByTitle(spaceKey, pageTitles)[0]
96+
contentType = "application/json"
97+
headers = {'Accept' : 'application/json'}
98+
pageList = []
99+
pageStr = ''
100+
for pageTitle in pageTitles:
101+
searchByPageTitleUrl = '/rest/api/content/' + pageID + '?expand=body.storage'
102+
response = self.httpRequest.get(searchByPageTitleUrl, contentType=contentType, headers=headers, quotePlus=True)
103+
if response.getStatus() not in HTTP_SUCCESS:
104+
self.throw_error(response)
105+
result = json.loads(response.response)
106+
for page in result['body']['storage']['value']:
107+
pageStr = pageStr + page
108+
109+
pageList.append(pageStr)
110+
return pageList
111+
93112
def updatePage(self, spaceKey, pageId, pageTitle, pageText):
94113
print "Executing updatePage() in ConfluenceClient\n"
95114
contentType = "application/json"

src/main/resources/confluence/ConfluenceClientUtil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/confluence/HttpRequestPlus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/confluence/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/confluence/addCommentToWikiPages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/confluence/addWikiPages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

src/main/resources/confluence/deleteWikiPages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2017 XEBIALABS
2+
# Copyright 2018 XEBIALABS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55
#

0 commit comments

Comments
 (0)