diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index 9bd7c7dec2..019abb26d2 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -1108,6 +1108,11 @@ class addressbook_groupdav extends Api\CalDAV\Handler $keys['id'] = $id; } } + // json with uid + elseif (empty(self::$path_extension) && (string)$id !== (string)(int)$id) + { + $keys['uid'] = $id; + } else { $keys[self::$path_attr] = $id; diff --git a/doc/REST-CalDAV-CardDAV/README.md b/doc/REST-CalDAV-CardDAV/README.md index d203c94df5..aae51ee955 100644 --- a/doc/REST-CalDAV-CardDAV/README.md +++ b/doc/REST-CalDAV-CardDAV/README.md @@ -278,6 +278,60 @@ Location: https://example.org/egroupware/groupdav.php//addressbook/123 * **PUT** requests with a ```Content-Type: application/json``` header allow modifying single resources (requires to specify all attributes!) +
+ Example: PUT request to update a resource + +``` +cat </addressbook/1234' -X PUT -d @- -H "Content-Type: application/json" --user +{ + "uid": "5638-8623c4830472a8ede9f9f8b30d435ea4", + "prodId": "EGroupware Addressbook 21.1.001", + "created": "2010-10-21T09:55:42Z", + "updated": "2014-06-02T14:45:24Z", + "name": [ + { "type": "@type": "NameComponent", "personal", "value": "Default" }, + { "type": "@type": "NameComponent", "surname", "value": "Tester" } + ], + "fullName": { "value": "Default Tester" }, +.... +} +EOF + +HTTP/1.1 204 No Content +``` +
+ +
+ Example: PUT request with UID to update an existing resource or create it, if not exists + +``` +cat </addressbook/5638-8623c4830472a8ede9f9f8b30d435ea4' -X PUT -d @- -H "Content-Type: application/json" --user +{ + "uid": "5638-8623c4830472a8ede9f9f8b30d435ea4", + "prodId": "EGroupware Addressbook 21.1.001", + "created": "2010-10-21T09:55:42Z", + "updated": "2014-06-02T14:45:24Z", + "name": [ + { "type": "@type": "NameComponent", "personal", "value": "Default" }, + { "type": "@type": "NameComponent", "surname", "value": "Tester" } + ], + "fullName": { "value": "Default Tester" }, +.... +} +EOF +``` +Update of an existing one: +``` +HTTP/1.1 204 No Content +``` +New contact: +``` +HTTP/1.1 201 Created +Location: https://example.org/egroupware/groupdav.php//addressbook/1234 +``` +
+ + * **PATCH** request with a ```Content-Type: application/json``` header allow to modify a single resource by only specifying changed attributes as a [PatchObject](https://www.rfc-editor.org/rfc/rfc8984.html#type-PatchObject)