I am currently trying to manipulate groups of my contact list in iCloud through CardDav protocol. For that, I created a group containing a contact in Contact.app: Screenshot
When I export the vCard of my contact directly from Contact app, I have the groups associated with my contacts in the CATEGORIES property :
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//Mac OS X 10.9.2//EN
N:Lebron;Candide;;;
FN:Candide Lebron
ORG:Podbox;
NOTE:Un petit peu candide.
CATEGORIES:GroupForAutomaticTestDELTA
UID:d4c1baf6-f603-4fb5-8f19-d45eb1e7fb23
X-ABUID:D4C1BAF6-F603-4FB5-8F19-D45EB1E7FB23:ABPerson
END:VCARD
However when I request my iCloud server to retrieve this contact I do not get CATEGORIES property set but I retrieve two vCards, one for the contact and one for the group. The group vCard contains references to its members.
Request:
curl --request REPORT --user ****@*****:**** --header "Content-Type: text/xml" --data '
<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-query xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<C:address-data/>
</D:prop>
</C:addressbook-query>' https://contacts.icloud.com/802592377/carddavhome/card/
contact VCard:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//Mac OS X 10.9.2//EN
N:Lebron;Candide;;;
FN:Candide Lebron
ORG:Podbox;
NOTE:Un petit peu candide.
REV:2014-06-12T16:53:51Z
UID:d4c1baf6-f603-4fb5-8f19-d45eb1e7fb23
END:VCARD
group vCard:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//AddressBook 8.0//EN
N:GroupToBeAddedTO
FN:GroupToBeAddedTO
X-ADDRESSBOOKSERVER-KIND:group
X-ADDRESSBOOKSERVER-MEMBER:urn:uuid:d4c1baf6-f603-4fb5-8f19-d45eb1e7fb23
REV:2014-06-12T16:43:04Z
UID:d59c9f0c-27aa-47e3-96e7-43717bbc1d7e
END:VCARD
Notice the CATEGORIES property appearing in contact export but not with a CardDAV request. My guess would be that the Contact app constructs the CATEGORIES when exporting but I am not sure.
Do someone has an idea of how iCloud works exactly? Am I missing something preventing me to retrieve CATEGORIES through CardDAV?