Google Contacts feed is breaking gdata-contacts-3.0-1.47.1 - google-api

This is for Google API folks.
Not sure when exactly the feed has changed but very recently (today or a couple of days ago). the GDATA library can't process Google Contacts feed anymore, failing with this:
com.yoxel.sync.core.exceptions.SyncException: com.google.gdata.util.ParseException: [Line 30, Column 86, element gContact:website] Invalid value for attribute : 'rel'
value=http://schemas.google.com/g/2005#profile
GDATA library seems to be expecting capital PROFILE but the feed started to send lowercase!
for (Enum enumValue : (Enum[])enumClass.getEnumConstants()) {
if (enumToAttributeValue.getAttributeValue(enumValue).equals(value){
return enumValue;
}
}
Is there more recent gdata library available?
Thank you.
10/9/20 Update:
For those migrating to the new People API check out our new unified API platform Aurinko.io

Seems like Google contacts feed API is currently broken when creating/updating contacts if a contact has relations/events/websites.
Ticket is already filed at https://issuetracker.google.com/u/0/issues/70209603

It appears that Google has now corrected the problem.

Related

Delete "Other Contact" using Python with Google People API

I used Google People API v1.otherContacts.copyOtherContactToMyContactsGroup (reference) to copy a contact from "Other Contacts" to "myContacts" contact group. I now want to delete the original contact from "Other Contacts" using the same API.
REST Resource v1.otherContacts (reference) does not list a DELETE action.
I tried using v1.people.deleteContact (reference) passing the resource name of my "Other Contact":
import pickle
from googleapiclient.discovery import build
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
people_api = build('people', 'v1', credentials=creds)
people_service = people_api.people()
response = people_service.deleteContact(resourceName='otherContacts/c1971897568350947161').execute()
But I got an error saying:
TypeError: Parameter "resourceName" value "otherContacts/c1971897568350947161" does not match the pattern "^people/[^/]+$"
Looks like v1.people.deleteContact does not work for deleting a contact in "Other Contacts".
How can I programmatically delete a contact from "Other Contacts"?
EDIT: Based on #DaImTo's suggestion below, I tried replacing otherContacts/ in the resource name with people/ and invoking the v1.people.deleteContact API, but I got an error saying:
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://people.googleapis.com/v1/people/c1971897568350947161:deleteContact?alt=json returned " generic::NOT_FOUND: Contact person resources are not found.". Details: "[{'#type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'resourceNames[0]', 'description': 'Resource not found.'}]}]">
I advice consulting the documentation for people.deleteContact
Required. The resource name of the contact to delete.
DELETE https://people.googleapis.com/v1/{resourceName=people/*}:deleteContact
That means it should be people/c1971897568350947161 assuming that is the id of the user you want to delete c1971897568350947161.
Looks like Other Contacts are read only, according to this announcement from Google: https://developers.google.com/contacts/v3/announcement
The new People API has the same functionality as the legacy Contacts
API for all features, with the following exceptions for “Other
Contacts”:
Administrators have read-only permissions for “Other Contacts” through
the new scope. As sending mutate/write signals back to “Other
Contacts” is not supported, your users will have to add the Other
Contact as a My Contact if they wish to update its data fields.

Google CivicInfo API Zip Codes for PR

I am trying to use the Civic Info API V2 to replace the now-defunct Sunlight Labs Congressional Legislator API. To do this I am passing an zip code string as the address into the Google API. However, when I try to pass the zip code for a Puerto Rico address, "00924" I'm returned a 404 - No information for this address. I get the same error when I add the city to the query, San+Juan+PR+00924. Puerto Rico has one Delegate Representative in the US House of Reps.
I'm using ruby's google-api-client gem to access the API in my program, but I get the same errors using the web API. Other zip codes work - just having troubles with this one.
Can anyone help me figure out how to get Delegate's name and information using this API?
EDIT: My current ruby code
def legislators_by_zip_code(zip)
civic_info = Google::Apis::CivicinfoV2::CivicInfoService.new
civic_info.key = '<My API Key>'
return if zip == "00000"
legislators = civic_info.representative_info_by_address(
address: zip,
levels: 'country',
roles: ['legislatorUpperBody', 'legislatorLowerBody'])
end

Accessing entire netflix catalog via API v1.5

Netflix recently updated their API methods for obtaining the full Netflix catalog. I'm curious if anyone has had any success accessing these new xml documents and downloading them via API v1.5 (9/2012). Previously, you could download the entire Netflix catalog via one API call (which I had working perfectly). Now, there are supposedly two calls to make: one for dvd's and one for streaming movies.
I cannot make these calls return anything except for an empty array. Please don't offer an answer unless you have personally downloaded the entire catalog via these new API's.
Bonus points if you can tell me how to do it in Ruby.
http://developer.netflix.com/blog/read/Update_Changes_for_the_Public_API
This did it for me (download the netflix instant cat)...it's in php but can prob be easily rewritten in ruby..this is using JR Collings OAuthsimple
args = Array(
max_results=> 20,
start_index=>0
);
//args don't matter, netflix doesn't listen here
// this is the URL path (note the lack of arguments.)
$rpath = "http://api-public.netflix.com/catalog/titles/streaming";
// Create the Signature object.
$roauth = new OAuthSimple();
$rsigned = $roauth->sign(Array(path=>$rpath,
parameters=>$args,
signatures=> Array('consumer_key'=>YOURKEY,
'shared_secret'=>YOURSECRET,
)));
$getxml = file_get_contents($rsigned['signed_url']);
file_put_contents("streaming.xml", $getxml);

How to build html link to a google calendar event?

Using the google calendar API v3, I added an event to a google calendar. Now I want to built an html link so that someone can click and view the calendar event.
Here's what I have tried:
View Google
the href looks like:
https://www.google.com/calendar/feeds/default/private/full/bigstringhere1ovmuup7mjf0
Problem is I get a a 401 Error "Authorization Required"
How can I build a link to view/edit the calendar event based on a google calendar ID?
There is a way! To view a public calendar event, use a link of the form:
https://www.google.com/calendar/event?eid={event-id}&ctz={timezone}
where {event-id} is the unique event id, and {timezone} is one of these time zones.
Here's an example: link to a specific public calendar event.
If you have editing rights to the calendar this event is from, you will be able to edit the event and see the guest list. Otherwise, you just see the public information about the event.
Since it can be difficult to determine the event id, here's a bookmarklet that produces a link to your Google Calendar event when you are editing its Details page:
javascript:(function(){ try { window.prompt('Shareable link to this event:','https://www.google.com/calendar/event?eid='+document.getElementsByClassName('ep')[0].getAttribute('data-eid')) } catch (e) {alert("Use this bookmarklet to get a shareable link to a Google Calendar event when editing its Details page.")}})()
And a version of this bookmarklet which works with the new (as of 2017) Google Calendar UI:
javascript:(function(){
window.prompt('Shareable link to this event:',
'https://www.google.com/calendar/event?eid='+
window.location.href.split("/").pop().split("?")[0])
})()
(Also possibly useful, how to link to a specific day of a public Google calendar:
https://www.google.com/calendar/embed?src={calendar-id}&mode=day&dates={yyyymmdd}%2F{yyyymmdd}
where {calendar-id} is the calendar's id and {yyyymmdd} is the day you want to link to.
Optional parameters include the time zone and whether to display various items, for example:
&ctz=Asia/Taipei&showNav=0&showPrint=0&showCalendars=0
Example: link to single day of a public calendar.)
Here is the HTML to build the link:
https://www.google.com/calendar/render?action=TEMPLATE&text=Your+Event+Name&dates=20140127T224000Z/20140320T221500Z&details=For+details,+link+here:+http://www.example.com&location=Waldorf+Astoria,+301+Park+Ave+,+New+York,+NY+10022&sf=true&output=xml
Event URL is not calendar URL.
This link brings explanations: Google Calender v3
And the way to build this url is:
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
where calendarId & eventId are parametres.
Hope this is helpfull.
I wanted to post this because it is tangental to the question being asked and this post comes up when I was trying to do the following.
I was trying to generate a Google Event for the sole purpose of being added to other people's calendars, not saved to any particular calendar. I've found an example here and I'm currently trying to figure out the URL params it accepts.
https://www.google.com/calendar/render?action=TEMPLATE&text=PRP+Due&dates=20141106T120000Z/20141106T120000Z&details&location&trp=false
To view Google calender event by event Id.
You can use below example:
https://www.google.com/calendar/event?eid={event-id}&ctz={timezone}
Example For Indian TimeZone :
https://calendar.google.com/calendar/event?eid=ZjVicWczYWpndmh0ZmdtYmd0cXFxZWc3czggdTJoZmoybGg0aDcwbmhzMzV2c25pamd1dG9AZw&ctz=Asia/Kolkata
To create a page where users can view the Calendar of Events publicly, a user who has permissions to change calendar sharing settings must first make the calendar public:
From the Google Calendar, at the top right, click the Settings wheel.
In Settings, click the "Calendars" tab.
Click the name of the Calendar you're working with.
Next, click the "Share this Calendar" tab. Make sure the checkboxes are checked from the screenshot below (circled in red).
Afterwards, click the "Calendar Details" tab, located at the top left.
Scroll down to the "Calendar address" section, as shown in the screenshot below.
Click "HTML".
A popup modal will appear, which includes the public URL you'll need to access the Calendar publicly.
Here is an example of what the URL might look like:
https://www.google.com/calendar/embed?src=domain.comrandomstring#group.calendar.google.com&ctz=America/Los_Angeles&gsessionid=OK
In addition, see the Google Calendar Data API for information on creating and working with Calendar Gadgets.
To get the event from the Google Calendar API v3, call:
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
The event contains a property htmlLink, which is exactly what you need:
An absolute link to this event in the Google Calendar Web UI. Read-only.
See https://developers.google.com/google-apps/calendar/v3/reference/events.
The link looks like this:
https://www.google.com/calendar/event?eid=XzYwcTMwYzFnNjBvMzBlMWk2MG80YWMxZzYwcmo4Z3BsODhyajJjMWg4NHMzNGg5ZzYwczMwYzFnNjBvMzBjMWc2c28zMmRoaDhwMGpnaDIxNnQyNDZkaGc2NG8zMGMxZzYwbzMwYzFnNjBvMzBjMWc2MG8zMmMxZzYwbzMwYzFnNzByNDRoMWk2b3AzOGUxazZoMms2aDFrNmQwamNkaTI2OHBrMmhpMjg4czRjZ2hoNzBwMF8yMDA2MDUwNSBob3BtYW4ubmxfbjE5ZGF2YWgxb3Zkb3EzbGl2N2t1aWU5Z.
It will open the event full screen, only of course if you have access to the event. The screen will contain a back button to go back to the calendar.
Clearly, you can't construct this link yourself so you will need to do a call to the API, but you are probably already doing that anyway.
When an google calendar event created, then in the response we got result property. In this result property, one more htmlLink would be available which have link regarding the event being created. Now, it can opened :
window.open(response.result.htmlLink, '_target');
Wordpress + ACF google cal.
Set your ACF date picker to custom return Y-m-d g:i a
Then create a google formatted date.
$event_start_date = get_field('event_start_date');
$event_print_date = date('d/m/Y',strtotime($event_start_date));
$event_start_time = get_field('event_start_time');
$event_end_date = get_field('event_end_date');
$event_print_enddate = date('d/m/Y',strtotime($event_end_date));
$event_end_time = get_field('event_end_time');
$calendarDate = date('Ymd',strtotime($event_start_date)) .'T'. date('Hi',strtotime($event_start_time)). '00/' . date('Ymd',strtotime($event_end_date)) .'T'. date('Hi',strtotime($event_end_time)) . '00';
Link
Add this event to my Google Calendar
private string GetEventLink(string calendarId, string eventId)
{
var calendarIdToEncode = calendarId.Substring(0, calendarId.IndexOf("#", StringComparison.Ordinal) + 2);
var eId = Convert.ToBase64String(Encoding.UTF8.GetBytes(eventId + " " + calendarIdToEncode));
return $"https://www.google.com/calendar/event?eid={eId.Substring(0, eId.Length - 2)}";
}
Google Have created a page to DIY.
https://support.google.com/calendar/answer/3033039

Implements a local restaurant search

I am currently trying to have a feature similar to the local scout (search button -> proximity) in my Windows Phone 7 app.
I'd like to get the 10 top restaurants or bars/clubs near my current location. Getting the geolocation of the user is the easy part.
Now I'd like to pass this location to an API and get the results.
I tried Bing Search API but I didn't figure out how to get special locations such as restaurants. And the SOAP service connection wasn't working from my phone.
Then I searched from others API... it seems that Google or Yahoo (PlaceFinder) or maybe Foursquare can be used too. But before investigating further, do you have any ideas of a simply solution to implement the local scout from Bing ?
Or is there another way to implement this feature ?
Oh, and I am french but not specially targeting a market so I'd like to use an international service.
Thanks a lot.
Damien
EDIT :
I guess I found a part of my solution :
Get business type/industry from Bing Phonebook API
As I want to use the Bing Search WSDL, I added a service reference to http://api.search.live.net/soap.asmx?AppId=42 (where 42 is my app key).
When I execute (from my phone) a simple test :
public void Test()
{
BingPortTypeClient bing = new BingPortTypeClient();
SearchRequest request = new SearchRequest();
request.AppId = AppId;
request.Sources = new SourceType[] { SourceType.Web };
request.Query = "restaurant";
bing.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(bing_SearchCompleted);
bing.SearchAsync(request);
}
void bing_SearchCompleted(object sender, SearchCompletedEventArgs e)
{
}
I am getting the following exception :
There was no endpoint listening at http://api.search.live.net/soap.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Inner : The remote server returned an error: NotFound.
I thought using this API would be quite more easy and well-documented...

Resources