suckless shell example

141 views
Skip to first unread message

Kai Hendry

unread,
Apr 28, 2008, 9:40:36 AM4/28/08
to Google Contacts API
Been looking into your API today.

I wrote a shell script to rip down my test account's email addresses.

I'm sharing the script as it may be useful for learning purposes:
http://static.webvm.net/GoogleContactsAPI/

It uses http://packages.qa.debian.org/x/xml2.html which attempts to
parse that unreadable XML.

Someone bring back CSV. ;)

Now I wonder how I PUT & DELETE from shell.

Jeff S

unread,
Apr 29, 2008, 5:32:05 PM4/29/08
to Google Contacts API
Hello Kai,

This looks really interesting and thank you for sharing. We could
really use more scripts and examples like this. It looks like you are
using wget for the HTTP GET operations, and one of the tools that you
might want to consider is curl for performing PUTs and DELETEs. If you
want to stick with wget, it might be possible to use POST with the X-
HTTP-Method-Override header to specify a PUT or DELETE. Here are some
resources that you might find useful: The first is an article on using
curl Google Data APIs, and the second (which you've probably already
read) is the developer guide with examples in HTTP and XML instead of
using one of the provided client libraries.

http://code.google.com/support/bin/answer.py?answer=78451&topic=12022
http://code.google.com/apis/contacts/developers_guide_protocol.html

Please keep me updated on this. Working with tools like curl and wget
can be extremely helpful in understanding how these AtomPub protocols
work.

Happy coding,

Jeff

On Apr 28, 6:40 am, Kai Hendry <kai.hen...@gmail.com> wrote:
> Been looking into your API today.
>
> I wrote a shell script to rip down my test account's email addresses.
>
> I'm sharing the script as it may be useful for learning purposes:http://static.webvm.net/GoogleContactsAPI/
>
> It useshttp://packages.qa.debian.org/x/xml2.htmlwhich attempts to

Kai Hendry

unread,
Apr 30, 2008, 5:10:10 AM4/30/08
to Google Contacts API
Yes, I did later find http://code.google.com/support/bin/answer.py?answer=78451&topic=12022

Strange how you can alter the topic of that answer.


I did try the cURL examples yesterday, but I couldn't manage an
update. Kept on getting bad requests. :/

That cURL article really should be expanded. I don't like ClientLogin.
Manage domains seems to think I can only run one CGI on a domain. Bit
limiting.

I went on to write http://gdata.webvm.net/a.txt to test:
scope="http://www.google.com/calendar/feeds/"
service="http://www.google.com/calendar/feeds/default/allcalendars/
full"

But that doesn't work. I kept getting a HTTP/1.0 401 Token revoked. :(

Be good if I could find coherent documentation about scope&service
URLs. Bit cryptic so far.


What I am trying to do is actually get stuff ultimately in a
Javascript data structure. So if you had some sort of Javascript
contacts API or at least a roadmap for one, it would save a lot of
time in front of the computer.
I wonder if there is a good C tool to convert XML to JSON.

Anyway, I'm no fan of this AtomPub stuff you Google guys came up with.
Nightmare to parse. Even harder to push things to you. ;)

Oh I did come across:
http://video.google.com/contacts/data/contacts?thumb=true&groups=true&show=PICKER&enums=true&psort=Name&max=300&out=js&rf=Emails&jsx=true

So I know you guys can do it. ;)

--
http://hendry.iki.fi/

Kai Hendry

unread,
May 21, 2008, 10:36:20 AM5/21/08
to Google Contacts API
I improved my script a little. Good for people looking for a CSV
interface to Google Contacts.

http://static.webvm.net/GoogleContactsAPI/showemails.txt
Reply all
Reply to author
Forward
0 new messages