Google CardDAV - returning "error", no indication why?

252 views Asked by At

Ok, I'm trying to do very simple queries against the Google CardDAV interface. I have a valid OAuth key, I have a valid email address. Using curl, attempting this:

curl --request REPORT  \
     --header "Content-Type: text/xml" \
     --header "Depth: 1" \
     --header "Authorization: Bearer <OAuth Key Here>" \
     --data-ascii "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
                  <D:addressbook-query xmlns:card="urn:ietf:params:xml:ns:carddav"
                     xmlns:cs="http://calendarserver.org/ns/" xmlns:D="DAV:"
                     xmlns:ical="http://apple.com/ns/ical/"> \
                    <card:allprop/> \
                  </D:addressbook-query>" \
https://www.googleapis.com/carddav/v1/principals/<Email Address Here>/lists/default

I have validated the XML, but the response I'm getting from google is:

<?xml version="1.0" encoding="UTF-8"?>
<d:error xmlns:d="DAV:"/>

It would be helpful if I knew what was in error. Any suggestions?

1

There are 1 answers

0
Derek Wade On

the namespace for the addressbook-query should be card, not DAV and the allprop should be DAV. I also found that Google CardDav requires a filter, but you can include an empty criteria and it will return all elements. See below:

<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:allprop>
    <D:getetag />
    <C:address-data content-type="application/vcard+xml" version="4.0"/>
</D:allprop>
<C:filter>
    <C:prop-filter name="FN">
    </C:prop-filter>    
</C:filter>
</C:addressbook-query>