Skip to content

Commit e17f4f6

Browse files
authored
Merge pull request #42 from dataiku/enhancement/wiki-ids
Dataiku API for wiki ids
2 parents 6c50654 + a7c8871 commit e17f4f6

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

dataikuapi/dss/wiki.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ def list_articles(self):
6363
"""
6464
return self.__flatten_taxonomy__(self.get_settings().get_taxonomy())
6565

66-
def create_article(self, article_id, parent_id=None, content=None):
66+
def create_article(self, article_name, parent_id=None, content=None):
6767
"""
6868
Create a wiki article
6969
70-
:param str article_id: the article ID
70+
:param str article_name: the article name
7171
:param str parent_id: the parent article ID (or None if the article has to be at root level)
7272
:param str content: the article content
7373
:returns: the created article
7474
:rtype: :class:`dataikuapi.dss.wiki.DSSWikiArticle`
7575
"""
7676
body = {
7777
"projectKey": self.project_key,
78-
"id": article_id,
78+
"name": article_name,
7979
"parent": parent_id
8080
}
81-
self.client._perform_json("POST", "/projects/%s/wiki/" % (self.project_key), body=body)
82-
article = DSSWikiArticle(self.client, self.project_key, article_id)
81+
result = self.client._perform_json("POST", "/projects/%s/wiki/" % (self.project_key), body=body)
82+
article = DSSWikiArticle(self.client, self.project_key, result['article']['id'])
8383

8484
# set article content if given
8585
if content is not None:
@@ -222,7 +222,7 @@ def get_data(self):
222222
:returns: the article data handle
223223
:rtype: :class:`dataikuapi.dss.wiki.DSSWikiArticleData`
224224
"""
225-
article_data = self.client._perform_json("GET", "/projects/%s/wiki/%s" % (self.project_key, dku_quote_fn(self.article_id)))
225+
article_data = self.client._perform_json("GET", "/projects/%s/wiki/%s" % (self.project_key, self.article_id))
226226
return DSSWikiArticleData(self.client, self.project_key, self.article_id, article_data)
227227

228228
def upload_attachement(self, fp, filename):
@@ -298,6 +298,23 @@ def set_metadata(self, metadata):
298298
"""
299299
self.article_data["article"] = metadata
300300

301+
def get_name(self):
302+
"""
303+
Get the article name
304+
305+
:returns: the article name
306+
:rtype: str
307+
"""
308+
return self.article_data["article"]["name"]
309+
310+
def set_name(self, name):
311+
"""
312+
Set the article name
313+
314+
:param str name: the article name
315+
"""
316+
self.article_data["article"]["name"] = name
317+
301318
def save(self):
302319
"""
303320
Save the current article data to the backend

0 commit comments

Comments
 (0)