From 2b6d9db83a0186681d38d05f068c2baebcf57b05 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 8 May 2015 16:32:26 -0400 Subject: [PATCH] API documentation for batchDelete Also return a proper JSON-payload in case of an error --- UI/Common/UIxFolderActions.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 2b36d7173..ed206cb8b 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -298,6 +298,20 @@ return response; } +/** + * @api {post} /so/:username/:folderPath/batchDelete?uids=:uids Delete multiple resources + * @apiVersion 1.0.0 + * @apiName GetBatchDelete + * @apiGroup Common + * @apiExample {curl} Example usage: + * curl -i http://localhost/SOGo/so/sogo1/Contacts/personal/batchDelete \ + * -H 'Content-Type: application/json' \ + * -d '{ "uids": ["1BC8-52F53F80-1-38C52041.vcf", "4095-52B0C180-31-9225E71.vlf"] }' + * + * @apiParam {String[]} uids List of resources IDs + * + * @apiError (Error 400) {Object} error The error message + */ - (id) batchDeleteAction { WOResponse *response; @@ -315,8 +329,9 @@ } else { - response = [self responseWithStatus: 500]; - [response appendContentString: @"At least 1 id required."]; + response = [self responseWithStatus: 400 + andJSONRepresentation: [NSDictionary dictionaryWithObject: @"At least 1 id required." + forKey: @"error"]]; } return response;