From 9a8457deff4ae367aa927e5aad07dbc5948aba23 Mon Sep 17 00:00:00 2001 From: sangramga Date: Sat, 31 Mar 2018 15:42:58 +0530 Subject: [PATCH] Added Post multiple groups API --- jupyterhub/apihandlers/groups.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jupyterhub/apihandlers/groups.py b/jupyterhub/apihandlers/groups.py index e03ab7cc..217cf433 100644 --- a/jupyterhub/apihandlers/groups.py +++ b/jupyterhub/apihandlers/groups.py @@ -45,10 +45,12 @@ class GroupListAPIHandler(_GroupAPIHandler): async def post(self): """POST creates Multiple groups """ model = self.get_json_body() - self._check_group_model(model) if not model or not isinstance(model, dict) or not model.get('groups'): raise web.HTTPError(400, "Must specify at least one group to create") - groupnames = model.get("groups",[]) + + groupnames = model.pop("groups",[]) + self._check_group_model(model) + created = [] for name in groupnames: existing = orm.Group.find(self.db, name=name)