1

I'm not able to parse the Google Calendar events with the Google Calendar API.

URL feedUrl = new URL("https://www.googleapis.com/calendar/v3/calendars/"+ emailAddress +"/events/");
EventFeed eventFeed = calendarService.getFeed(feedUrl, EventFeed.class);

Exception, last line:

com.google.gdata.util.ParseException: Unrecognized content type:application/json;charset=UTF-8
1

1 Answer 1

1

gdata.util leads me to believe that you are trying to use the Gdata client library.

But you appear to be trying to feed it the end point for V3 of the Google Calendar API. Which isn't going to work because the V3 of the Google Calendar is a discovery service API and not a GData API. Discovery API return jSon, gData APIs return xml so there is no way the gData Client library can understand what the V3 API is trying to tell it. Hence the Unrecognized content type:application/json

I think you should start by downloading the current Google API java client library.

Also note that the GData version of the Google Calendar API was shut down November 17, 2014 So I don't believe you will be able to use the gdata client library to access Google Calendar

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I thought it's the same as google contacts. Is there a possibility to set the accessToken to get the events? developers.google.com/google-apps/calendar/v3/reference/events/…
That's a different question and one I can't help with. I have very little experience with the Java client lib. Try making a new question someone will probably be able to answer. Google contacts is a gdata api that's why it works.
Thanks, I think I've found a solution:GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credential) .setApplicationName("App-Name").build();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.