Creating contacts with the new javascript library. Is that possible?

190 views
Skip to first unread message

Rubén Sánchez

unread,
Jan 9, 2012, 6:30:57 AM1/9/12
to google-co...@googlegroups.com
I finished last week an application that works along with the calendar API using javascript. I specifically use this library created by Dan Holevoet.

http://googleappsdeveloper.blogspot.com/2011/12/using-new-js-library-to-unlock-power-of.html

However, here my questions:

1. I don't see any example of that library using contacts. Is that possible to use that library for managing contacts? If so:
- what is the accurate scope?
- what is the structure of the resource (json) if i want to add a new contact?
- How can I create the request?  var request = gapi.client.calendar.events.insert??
2. Trying to use the Google API explorer and trying to select a service, I come across that contacts is not listed as a service. Why?

Thanks in advance
Regards





Dan Holevoet

unread,
Jan 9, 2012, 2:30:12 PM1/9/12
to google-co...@googlegroups.com
Hi Ruben,

It's not currently possible to use the new JS library with the Contacts API, as the current version of the Contacts API doesn't support the discovery protocol the JS library needs to construct the methods used to interact with the API. However, if we release a new version of the Contacts API that does support discovery, the JS library will work automatically.

Similarly, the API Explorer also relies on the discovery API, so Contacts will not be listed there unless a new version is released that supports discovery.

Thanks,
Dan

2012/1/9 Rubén Sánchez <ruben...@gmail.com>






--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
google-co...@googlegroups.com
To unsubscribe from this group, send email to
google-contacts...@googlegroups.com
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html



--
Dan Holevoet
Google Developer Relations

Koen Maes

unread,
Jan 11, 2012, 5:31:26 AM1/11/12
to google-co...@googlegroups.com
Hi Dan

In the google-api-client-java group, Yaniv Inbar - Google engineer, wrote :

In theory google-api-java-client support Google Contacts, but you have to write your own XML data model for it.  I recommend you ask this question on the Google Contacts support forum to ask them if they have plans to improve the situation.

But from your answer, I conclude it is not possible, not even when developing your own XML data model ?
I tried this :


GoogleOAuthDomainWideDelegation googleOAuthDomainWideDelegation = new GoogleOAuthDomainWideDelegation();
googleOAuthDomainWideDelegation.parameters = getOauthHmacParameters();
googleOAuthDomainWideDelegation.requestorId = "m...@mydomain.com";

HttpTransport transport = new NetHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(googleOAuthDomainWideDelegation);

HttpRequest request = requestFactory.buildGetRequest(new GenericUrl(url));
try {
printResponse(request.execute());

} catch (HttpResponseException e) {
printResponse(e.getResponse());
System.out.println("-------------- ERROR --------------");
System.out.println(e.getMessage());
}

And I do get results back. So it does seem to work ?
But since the API is not part of the discovery, I dont know where to find out about the structure of the feed.

Any feedback very welcome.

Koen

Koen Maes

unread,
Jan 11, 2012, 7:00:40 AM1/11/12
to google-co...@googlegroups.com
Ok, I see that I am not talking about the same library as the original poster....

Dan Holevoet

unread,
Jan 11, 2012, 6:08:59 PM1/11/12
to google-co...@googlegroups.com
Hi Koen,

Yes, that's correct. You can use the new Java library with non-discovery-based APIs, but not the Javascript one.

Thanks,
Dan

On Wed, Jan 11, 2012 at 4:00 AM, Koen Maes <ko...@koma.be> wrote:
Ok, I see that I am not talking about the same library as the original poster....

--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
google-co...@googlegroups.com
To unsubscribe from this group, send email to
google-contacts...@googlegroups.com
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html
Reply all
Reply to author
Forward
0 new messages