Batch Operation Response for Google Contacts API

20 views
Skip to first unread message

Test

unread,
May 15, 2009, 4:51:15 AM5/15/09
to Google Contacts API
Hi all,

My question is that while doing the batch operation in Google as
XML request and response, whether the response will change after some
days?
I have done a batch operation for insert.Below is the request and
the corresponding response I was getting till yesterday.

REQUEST
----------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:batch='http://schemas.google.com/gdata/batch'>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact' />
<entry>
<batch:operation type='insert' />
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2008#contact' />
<title type='text'>TEST</title>
</entry>
</feed>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

RESPONSE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<atom:feed xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gContact="http://schemas.google.com/contact/2008"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://
schemas.google.com/g/2005" xmlns:openSearch="http://a9.com/-/spec/
opensearchrss/1.0/">
<atom:id></atom:id>
<atom:updated></atom:updated>
<atom:title type="text">Batch Feed</atom:title>
<atom:link rel="http://schemas.google.com/g/2005#feed"
type="application/atom+xml" href="http://www.google.com/m8/feeds/
contacts/test.scf%40gmail.com/full"/>
<atom:link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml' href='http://www.google.com/m8/feeds/
contacts/test.scf%40gmail.com/full'/>
<atom:link rel="http://schemas.google.com/g/2005#batch"
type="application/atom+xml" href="http://www.google.com/m8/feeds/
contacts/test.scf%40gmail.com/full/batch"/>
<atom:entry>
<atom:id></atom:id>
<atom:updated></atom:updated>
<atom:category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/contact/2008#contact"/>
<atom:title type="text">TEST</atom:title>
<atom:link rel="http://schemas.google.com/contacts/2008/rel#edit-
photo" type="image/*" href="http://www.google.com/m8/feeds/photos/
media/test.scf%40gmail.com/18117d8c89228896/1B2M2Y8AsgTpgAmY7PhCfg"/>
<atom:link rel="self" type="application/atom+xml" href="http://
www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/18117d8c89228896"/>
<atom:link rel="edit" type="application/atom+xml" href="http://
www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/18117d8c89228896/1242376285953000"/>
<batch:status reason="Created" code="201"/>
<batch:operation type="insert"/>
</atom:entry>
</atom:feed>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

You will be seeing 3 <atom:link> tags for #feed,#post,#batch after
<atom:title type="text">Batch Feed</atom:title> tags here.

But Today I am not getting the entire line containing the <atom:link
rel='http://schemas.google.com/g/2005#post> in my response though the
contact is getting inserted into google..It would be a tough task if
the response is getting changed from time to time for the same
request.
Can anybody check on this issue?

Thanks,
Test

Julian (Google)

unread,
May 15, 2009, 11:05:36 AM5/15/09
to Google Contacts API
Hi,

I am not able to reproduce exactly the error you describe, please if
possible post also the other Response that is missing the links
relations.

Thanks,
Julian.
>     <atom:link rel="self" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/18117d8c89..."/>
>     <atom:link rel="edit" type="application/atom+xml" href="http://www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/18117d8c89..."/>

Test SCF

unread,
May 15, 2009, 11:18:44 AM5/15/09
to google-co...@googlegroups.com
Hi

   Yes sure. Here I have shown the Response getting below that is missing the links.
    I have highlighted the missing link 
   
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?><atom:feed xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gContact='http://schemas.google.com/contact/2008' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005'>
<atom:updated>2009-05-15T08:09:11.074Z</atom:updated>
<atom:title type='text'>Batch Feed</atom:title>

<!-- here <atom:link rel=http://schemas.google.com/g/2005#post> is missing. -->

<atom:entry>
<atom:updated>2009-05-15T08:09:11.062Z</atom:updated>
<atom:title type='text'>TEST</atom:title>
<batch:operation type='insert'/>
</atom:entry>
</atom:feed>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Julian (Google)

unread,
May 18, 2009, 11:51:09 AM5/18/09
to Google Contacts API
Hi,

Usually there are not big changes on the feeds, but changes like this
one could eventually happen. We'll try to post about changes in
advance.

Thanks,
Julian.

On May 15, 4:18 pm, Test SCF <test....@gmail.com> wrote:
> Hi
>    Yes sure. Here I have shown the Response getting below that is missing
> the links.
>     I have highlighted the missing link
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version='1.0' encoding='UTF-8'?><atom:feed xmlns:atom='http://www.w3.org/2005/Atom'xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'xmlns:gContact='http://schemas.google.com/contact/2008'xmlns:batch='http://schemas.google.com/gdata/batch'xmlns:gd='http://schemas.google.com/g/2005'>
> <atom:id>http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/full
> </atom:id>
> <atom:updated>2009-05-15T08:09:11.074Z</atom:updated>
> <atom:title type='text'>Batch Feed</atom:title>
> <atom:link rel='http://schemas.google.com/g/2005#feed'
> type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...>
>
> <!-- here <atom:link rel=http://schemas.google.com/g/2005#post> is missing.
> -->
>
> <atom:link rel='http://schemas.google.com/g/2005#batch'
> type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...
>
> <atom:entry>
> <atom:id>http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/ba...
> </atom:id>
> <atom:updated>2009-05-15T08:09:11.062Z</atom:updated>
> <atom:category scheme='http://schemas.google.com/g/2005#kind'term='http://schemas.google.com/contact/2008#contact'/>
> <atom:title type='text'>TEST</atom:title>
> <atom:link rel='http://schemas.google.com/contacts/2008/rel#edit-photo'
> type='image/*' href='http://www.google.com/m8/feeds/photos/media/test.gcontacts%40gmail.co...
>
> <atom:link rel='self' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...
>
> <atom:link rel='edit' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...
> >http://www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/181.....
> > ."/>
> > >     <atom:link rel="edit" type="application/atom+xml" href="
> >http://www.google.com/m8/feeds/contacts/test.scf%40gmail.com/full/181.....

Test SCF

unread,
May 19, 2009, 8:17:43 AM5/19/09
to google-co...@googlegroups.com
Thanks Julian,

One another question is that while retrieving the contacts using query parameters I found in the Contacts API reference guide like this:

GET http://www.google.com/m8/feeds/contacts/liz%40gmail.com/full?updated-min=2007-03-16T00:00:00

So in the URL we will pass the updated-min parameter to get the last updated contacts as per the date time.Similarly what is the procedure for getting the
last updated events using batch operation especially using <batch:operation type='query' />   through POST method?
What will be the URL given? How will be the Request and related Response ?

Regards,
Test.

Julian (Google)

unread,
May 20, 2009, 6:32:03 AM5/20/09
to Google Contacts API
Hi,

You can use the <updated> element, but only to query one Contact each
time because a Batch Query need the contact's ID, for example:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:gContact='http://
schemas.google.com/contact/2008' xmlns:gd='http://schemas.google.com/g/
2005' xmlns:batch='http://schemas.google.com/gdata/batch'>
<entry>
<batch:operation type='query' />
<id>http://www.google.com/m8/feeds/contacts/user\%40domain.com/
full/397fb58e8b9eb8ee/1242812330177000</id>
<updated>2009-05-20T09:38:50.177Z</updated>
</entry>
</feed>

To retrieve all contacts you would need to use the regular feed
instead of the batch.

--Julian

On May 19, 1:17 pm, Test SCF <test....@gmail.com> wrote:
> Thanks Julian,
> One another question is that while retrieving the contacts using query
> parameters I found in the Contacts API reference guide like this:
>
> GEThttp://www.google.com/m8/feeds/contacts/liz%40gmail.com/full?updated-...
>
> So in the URL we will pass the updated-min parameter to get the last updated
> contacts as per the date time.Similarly what is the procedure for getting
> the
> last updated events using batch operation especially using <batch:operation
> type='query' />   through POST method?
> What will be the URL given? How will be the Request and related Response ?
>
> Regards,
> Test.
>
> On Mon, May 18, 2009 at 9:21 PM, Julian (Google) <j...@google.com> wrote:
>
> > Hi,
>
> > Usually there are not big changes on the feeds, but changes like this
> > one could eventually happen. We'll try to post about changes in
> > advance.
>
> > Thanks,
> > Julian.
>
> > On May 15, 4:18 pm, Test SCF <test....@gmail.com> wrote:
> > > Hi
> > >    Yes sure. Here I have shown the Response getting below that is missing
> > > the links.
> > >     I have highlighted the missing link
>
> > -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > > <?xml version='1.0' encoding='UTF-8'?><atom:feed xmlns:atom='
> >http://www.w3.org/2005/Atom'xmlns:openSearch='http://a9.com/-/spec/op...
> > '>
> > > <atom:id>
> >http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/full
> > > </atom:id>
> > > <atom:updated>2009-05-15T08:09:11.074Z</atom:updated>
> > > <atom:title type='text'>Batch Feed</atom:title>
> > > <atom:link rel='http://schemas.google.com/g/2005#feed'
> > > type='application/atom+xml' href='
> >http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...>
>
> > > <!-- here <atom:link rel=http://schemas.google.com/g/2005#post> is
> > missing.
> > > -->
>
> > > <atom:link rel='http://schemas.google.com/g/2005#batch'
> > > type='application/atom+xml' href='
> >http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/fu...
>
> > > <atom:entry>
> > > <atom:id>
> >http://www.google.com/m8/feeds/contacts/test.gcontacts%40gmail.com/ba...
> > > </atom:id>
> > > <atom:updated>2009-05-15T08:09:11.062Z</atom:updated>
> > > <atom:category scheme='
> >http://schemas.google.com/g/2005#kind'term='http://schemas.google.com...
Reply all
Reply to author
Forward
0 new messages