From f1f3fa2f892811a17735ea1a543bcbbfa8cca790 Mon Sep 17 00:00:00 2001 From: Manuel Bovo Date: Thu, 6 Jun 2019 17:00:04 +0200 Subject: [PATCH] Exposing overwrite or version api parameters to caller --- grafana_api/api/folder.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/grafana_api/api/folder.py b/grafana_api/api/folder.py index 9781512..a2652bd 100644 --- a/grafana_api/api/folder.py +++ b/grafana_api/api/folder.py @@ -37,15 +37,23 @@ def create_folder(self, title, uid=None): json_data["uid"] = uid return self.api.POST("/folders", json=json_data) - def update_folder(self, uid, title): + def update_folder(self, uid, title, version=None, overwrite=False): """ :param uid: :param title: + :param version: + :param overwrite: :return: """ + body = {"title": title} + if version is not None: + body['version'] = version + if overwrite: + body['overwrite'] = True + path = "/folders/%s" % uid - r = self.api.PUT(path, json={"title": title}) + r = self.api.PUT(path, json=body) return r def delete_folder(self, uid):