Google CardDAV changes vCard UID - vcf-vcard

I'm integrating the Google CardDAV with my webApplication. I have a strange problem sometimes when I make a PUT of a new vCard.
If the vCard contains a UID and the UID is a GUID Google changes the vCard UID with a 16-char UID.
for example: This is my original vCard
BEGIN:VCARD
VERSION:3.0
N:Pinch;David;;;
FN:David Pinch
REV:2013-01-09T09:26:34Z
UID:6c34bedcf256408780d8ffe269ec2b3b
END:VCARD
So I PUT this into Google CardDAV, into the current url:
https://www.google.com/m8/carddav/principals/__uids__/myusername#gmail.com/lists/default/6c34bedcf256408780d8ffe269ec2b3b
The result is ok, and the contact is really created on Google Contacts.
BUT:
if "now" I retrieve the current vCard from the same URL i have the following response.
BEGIN:VCARD
VERSION:3.0
N:Pinch;David;;;
FN:David Pinch
REV:2013-01-09T09:44:25Z
UID:716212e795884e43
END:VCARD
You can see that UID has changed and passed from original
UID:6c34bedcf256408780d8ffe269ec2b3b
To
UID:716212e795884e43
Curiously if I retrieve the card with the following Request
https://www.google.com/m8/carddav/principals/__uids__/myusername#gmail.com/lists/default/716212e795884e43
I have Exactly the same Response, like the vCard references two different Path url.
However when i retrieve the list of the contact from CardDAV, this return the second URL.
If I does not create the vCard with a GUID but with a 16-char UID, Seems that Google accept this, but sometimes it changes However, so I cannot be sure of the uniqueness of the Card.
A workaround seem to be of re-download the vCard after every PUT, but this causes a payload important that I wanted to avoid.
I use the same procecures with iCloud CardDAV and this doesn't happen.
Anyone can help me?

When you PUT a vCard to Google CardDAV it will recreate a new vCard V3.0 and dispose the original data posted including data loss and the UID / URI path changes you describe.
Other then UID change Google CardDAV has other issues
Data loss
Rejection of valid vCards
Slowness (10-20s per write
operation)
More details in the following Google CardDAV stress test article:
https://evertpot.com/google-carddav-issues/
My advise after still seeing these failures in 2018: its better to use Google's Contacts API instead of there CardDAV implementation.

Related

how to find a username with the github api

I've made an application that creates pull requests to update the dependencies in all of my org's repos when the repo "Alpha" gets a new tag. The process is triggered by our CI flow on Alpha. Other engineers here would like to upgrade this application so that whoever made the tag is also automatically added as a requested reviewer to all of the associated pull requests. I do not see any way to do this with the github REST api. So far I have:
GET tag by name -> tag object sha
GET tag (with obj sha) -> tagger name & tagger email
*************GAP**************
POST requested reviewer (with username) -> completed!
I can't see any good way to get a username from the REST api with the name and/or email. I could query commits from Alpha and filter them, BUT "person who tagged" != "person who made last commit AND I know that at least one of our more prolific taggers is sometimes logged in from different emails (web vs cli vs home machine, etc), so the app might miss them from time to time.
I think it may be possible to get what I want via the GraphQL api, but I'd really like to exhaust REST possibilities before I go down that road. Please shoot any ideas my way!
After gathering more information, it looks like it's possible, and even slightly more elegant than I anticipated. If I have the name of the tag (the 'ref'), I can get a specific commit with that rather than the SHA. the response for this commit includes author information that gives the login. I can then use this along with the pull number to request a reviewer.

Adding Photo to vCard

I'm trying to create a vCard containing the text below:
BEGIN:VCARD
VERSION:3.0
PHOTO;VALUE=uri:https://upload.wikimedia.org/wikipedia/commons/2/25/Intel_logo_%282006-2020%29.jpg
N:Raven;Test;;;
END:VCARD
according to this documentation (
screenshot of the part I'm talking about ) I tried base64 and it's working fine ( Contact app loads the image ) but in the URI situation it's not working ( Contact app does not load the image ),
To avoid making a large file, my goal is to have a url in my vCard.vcf file not a base64, I'm stuck understanding what's wrong with my vCard.
basically what I'm trying to make is a vCard containing a photo that gets fetched by the url given and shows the photo in contact app of whatever OS the user will open it on (Windows/Android/IOS/macOS).
I'm not using base64 because it makes my vCard file so big.
External urls are probably blocked by most programs, same as loading external images are blocked. It's a massive privacy concern.
Maybe hosting it on a service like Google Cloud would help, in that you can edit the CONTENT-TYPE and CACHE meta data attributes? It’s my novice understanding that smartphone OS is particularly wary of “unknown” file properties - probably for good reason.

Google Contacts API 404 photo upload

Using the Contact API v3 I had a working implementation for uploading a photo to an existing contact.
Since a couple of weeks this fails with 404. The implementation has not been changed when the API servers started to sent back 404s and I don't see any indication what exactly changed and would result now in the 404s.
I'm using HTTP PUT + the photo URL of the contact.
One interesting observation I made was that the contact's self-URL changes which each request (the provided details are still always the same and correct).
Did anyone notice something similar ?
Edit: Link to issue: http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3301&q=contact&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Opened%20Summary
tried different photo formats and sizes, different content types and even photos which had been uploaded previously (when it was still working). Nothing changed the behaviour of returning 404.
w.r.t to change contact ids: the contact ID changes between API invocations. I first thought it could be related to reopened connection( no keep-alive) that contact ids change. However what speaks against this being the cause of the issue is that first retrieving a contact and then editing a contact's address is possible without any issues.
authentication does not seem to be problem as well - otherwise editing a contact's address would not work as well.
PS: I'm using the JSON output format when retrieving the contact.
PS2: s/GET/PUT in step 3 ( I tried to change PUT to GET to see if it still returns 404... which it does).
PS3: am not using any client library but implement the protocol directly (which should not be relevant for the HTTP PUT on the photo link
After hours of investigation I found out that this is particular an issue using OAuth1. Using OAuth2 the exact same photo links which had been returned when requesting a specific contact record using OAuth1 work and return the photo data on HTTP GET. I expect HTTP PUT for photo links using OAuth2 to succeed as well.
Remains open if if there's some kind of workaround for OAuth1.

Graph API not returning image/picture for community pages

Graph API is not returning image("picture" attribute) for objects corresponding to community pages, which used to be returned earlier. For example this https://graph.facebook.com/178790412179919 does not have picture attribute whereas the corresponding page has an image.
Also the FQL query done on the "albums" connection for some objects does not have a "cover_pid" attribute for an album corresponding to type "profile", which again used to work earlier.
Does anybody know if anything has changed in Graph API corresponding to this in last couple of weeks (I am fairly confident it used to work earlier in the expected way). I looked through Facebook API release notes but could not find any changes corresponding to this. Please let me know if this not appropriate post for this forum.
https://developers.facebook.com/docs/reference/api/page/
picture is a connection, not an attribute. So ...
https://graph.facebook.com/178790412179919/picture
And as the docs say: Returns a HTTP 302 with the URL of the user's profile picture.
Kinda goofy? Yes, but it works exactly as the docs say it does. I suspect they implemented it this way so it could easily be used in an <IMG> tag.
UPDATE:
It still works via FQL. In your case:
https://api.facebook.com/method/fql.query?query=SELECT+page_id%2C+pic+FROM+page+WHERE+page_id+%3D+178790412179919&format=json
I can confirm that this PREVIOUSLY worked, but NO LONGER works. Facebook have removed the picture connection from Community Pages.
I suspect the reason is that most of these images are pulled from Wikipedia, and there was a licensing / attribution issue.
Unfortunately, Facebook is no longer a reliable source of images for entities (e.g. bands).

Google Reader API - get subscribers

Anyone know the http request in order to find the subscriber count for a subscription?
Something similar to http://www.google.com/reader/api/0/unread-count?all=true must exist for subscribers, no?
This is what Reader uses to fill in the data in the "show details" UI for a particular feeed:
http://www.google.com/reader/api/0/stream/details?s=feed/https://blog.stackoverflow.com/feed/&output=json&fetchTrends=false
Specifically, you'd want the "subscribers" property in the JSON output. The general format for the "s" parameter is feed/". Note that it requires authentication.
I wanted to do this same thing but from PUBLIC location so i hacked together an API for everyones use... it returns as JSON or JSONP and i dont save any history of feeds that are looked up... but i do have logging to be able to ban abusive ip