diff --git a/astakosclient/astakosclient/__init__.py b/astakosclient/astakosclient/__init__.py index f7a4a255c9d6532b0c602c8701dbd05180a3666e..bb2ea7f53b0f0ad2f218f7c63a2a00877985b5be 100644 --- a/astakosclient/astakosclient/__init__.py +++ b/astakosclient/astakosclient/__init__.py @@ -861,7 +861,7 @@ class AstakosClient(object): method="POST") # ------------------------------------------ - # do a POST to ``API_PROJECTS``/<project_id> + # do a PUT to ``API_PROJECTS``/<project_id> def modify_project(self, project_id, specs): """Submit application to modify an existing project @@ -875,7 +875,7 @@ class AstakosClient(object): req_headers = {'content-type': 'application/json'} req_body = parse_request(specs, self.logger) return self._call_astakos(path, headers=req_headers, - body=req_body, method="POST") + body=req_body, method="PUT") # ------------------------------------------------- # do a POST to ``API_PROJECTS``/<project_id>/action diff --git a/docs/design/resource-pool-projects.rst b/docs/design/resource-pool-projects.rst index 884bf2bd5a5fc27d506c1125caee73da8291057d..176bdb23fa6eba2fe8bdd74f079b1ada2dc6e6fc 100644 --- a/docs/design/resource-pool-projects.rst +++ b/docs/design/resource-pool-projects.rst @@ -379,9 +379,8 @@ the container level. Changes in the projects API ``````````````````````````` -``PUT /projects`` will be used to make a new project replacing ``POST``. - -``POST /projects/<proj_id>`` now expects a dictionary with just the desired +``PUT /projects/<proj_id>`` will be used to mod a new project replacing +``POST``. It now expects a dictionary with just the desired changes, not a complete project definition. It is only allowed if the project is already activated. diff --git a/docs/project-api-guide.rst b/docs/project-api-guide.rst index 49083a823162367ac43b80ffd97babbed4e4207f..d409f93296006863a33bc14998a6450fd23e071e 100644 --- a/docs/project-api-guide.rst +++ b/docs/project-api-guide.rst @@ -155,7 +155,7 @@ Status Description Modify a Project ................ -**POST** /account/v1.0/projects/<proj_id> +**PUT** /account/v1.0/projects/<proj_id> ==================== ========================= Request Header Name Value diff --git a/snf-astakos-app/astakos/api/projects.py b/snf-astakos-app/astakos/api/projects.py index 68359c489a43b78604e459f7f033d092e92b44bf..32aa1ebdb97e45efaeb89b5ab84ecf392446bb19 100644 --- a/snf-astakos-app/astakos/api/projects.py +++ b/snf-astakos-app/astakos/api/projects.py @@ -329,9 +329,9 @@ def project(request, project_id): method = request.method if method == "GET": return get_project(request, project_id) - if method == "POST": + if method == "PUT": return modify_project(request, project_id) - return api.api_method_not_allowed(request, allowed_methods=['GET', 'POST']) + return api.api_method_not_allowed(request, allowed_methods=['GET', 'PUT']) @api.api_method(http_method="GET", token_required=True, user_required=False) @@ -352,7 +352,7 @@ def _get_project(project_id, request_user=None): return project -@api.api_method(http_method="POST", token_required=True, user_required=False) +@api.api_method(http_method="PUT", token_required=True, user_required=False) @user_from_token @transaction.commit_on_success def modify_project(request, project_id): diff --git a/snf-astakos-app/astakos/im/tests/projects.py b/snf-astakos-app/astakos/im/tests/projects.py index f310221544271dda9569bf6365fea5c7ac28d781..233f89e838a0a7ace3586e848971667a4bda0cfd 100644 --- a/snf-astakos-app/astakos/im/tests/projects.py +++ b/snf-astakos-app/astakos/im/tests/projects.py @@ -98,7 +98,7 @@ class ProjectAPITest(TestCase): def modify(self, app, project_id, headers): dump = json.dumps(app) kwargs = {"project_id": project_id} - r = self.client.post(reverse("api_project", kwargs=kwargs), dump, + r = self.client.put(reverse("api_project", kwargs=kwargs), dump, content_type="application/json", **headers) body = json.loads(r.content) return r.status_code, body