Hi all!
I want to make a facebook-Google contact sync tool with birthdays and
some more information,
My problem is that I can't manage retriving the contacts in
javascript, I can get the AuthSub token but after sending it to get
the contacts the server does not allow HTTP OPTIONS header.
Thanks! :D
Pau
This is the code:
function getContacts(){
xmlHttp = GetXmlHttpObject()
if(xmlHttp==null){
alert("Your browser does not support AJAX");
return;
}
var url = "http://www.google.com/m8/feeds/contacts/default/full";
xmlHttp.open("GET",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
xmlHttp.setRequestHeader("Authorization","AuthSub token=" + token);
xmlHttp.setRequestHeader("GData-Version","3.0");
xmlHttp.setRequestHeader("Connection", "keep-alive");
xmlHttp.onreadystatechange = gotContacts;
xmlHttp.send(null);
}
And this is the HTTP dialog:
http://www.google.com/m8/feeds/contacts/default/full
OPTIONS /m8/feeds/contacts/default/full HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/
20090803 Ubuntu/9.04 (jaunty) Firefox/3.0.5, Ant.com Toolbar 1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: ca,es-es;q=0.8,es;q=0.6,en-us;q=0.4,en;q=0.2
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Origin: http://crazy.ferrer-tura.org
Access-Control-Request-Method: GET
Access-Control-Request-Headers: authorization,gdata-version
HTTP/1.x 405 Method Not Allowed
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Date: Sun, 30 Aug 2009 16:18:59 GMT
Expires: Sun, 30 Aug 2009 16:18:59 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
Content-Length: 127
Server: GFE/2.0
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---