Reputation: 21
I am trying to create a group contact using Google Contacts v3.
Following the example, and testing within the OAuth 2.0 Playground, here is my sample code:
POST /m8/feeds/groups/default/full/ HTTP/1.1
Host: www.google.com
Gdata-version: 3.0
Content-length: 355
Content-type: application/atom+xml
Authorization: Bearer #{auth_code_goes_in_here}#
<atom:entry xmlns:gd="http://schemas.google.com/g/2005">
<atom:category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/contact/2008#group"/>
<atom:title type="text">Salsa group</atom:title>
<gd:extendedProperty name="more info about the group">
<info>Nice people.</info>
</gd:extendedProperty>
</atom:entry>
However, I keep getting the 400 error in the response:
HTTP/1.1 400 Bad Request
Alternate-protocol: 443:quic,p=1
Content-length: 236
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Fri, 11 Mar 2016 05:18:06 GMT
Vary: Origin, X-Origin
Server: GSE
-content-encoding: gzip
Cache-control: private, max-age=0
Date: Fri, 11 Mar 2016 05:18:06 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=2592000; v="31,30,29,28,27,26,25"
Content-type: application/vnd.google.gdata.error+xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<errors xmlns="http://schemas.google.com/g/2005">
<error>
<domain>GData</domain>
<code>invalid</code>
<internalReason>Entry does not have any fields set</internalReason>
</error>
</errors>
Any ideas what I am doing wrong here?
Further to this, I would like to create contacts in Google, with specific Group attached to it. Is this do-able from the 'creating contacts' method? I can't seem to find an example where I can specify the group directly to it.
Thanks for any suggestions.
Regards, Leroy
Upvotes: 0
Views: 198
Reputation: 21
After some painful research, I found the solution by changing the data from:
<atom:entry xmlns:gd="http://schemas.google.com/g/2005">
to
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005">
Upvotes: 2