Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 error when GET contact photo from Yahoo API

I use ShuttleCloud for import contacts, but he not support work with contacts photos. Since ShuttleCloud give me contact id, i easy recieved contact photo from Google, but cannot from Yahoo. (as i understand, microsoft not support mechanism for return contact photo).

For example i use url for get information about contact:

my $url = 'https://social.yahooapis.com/v1/user/72KIKWBUXCMY6XVHD5B5UN52PU/contact/13?format=json';

Then i use recieved url for GET image:

my $url = 'http://social.yahooapis.com/v1/user/72KIKWBUXCMY6XVHD5B5UN52PU/contact/13/Image/2';

All according to the documentation. But Yahoo return 404 Not Found on Accelerator. If i use https instead http, Yahoo return 404 Not Found.

Code with GET request:

my $ua  = LWP::UserAgent->new();
my $req = HTTP::Request->new(GET => $url);
$req->header('Authorization' => 'Bearer '.$token);
my $resp = $ua->request($req);

P.S. All requests using Single Field (name, address, etc) have similar return code and error.

My scopes: Contacts - Read/Write; Social Directory (Profiles) - Read/Write Public and Private.

like image 845
Kostiuk Aleksandr Avatar asked Nov 01 '22 00:11

Kostiuk Aleksandr


1 Answers

Looks like Yahoo contacts API is mostly dead/broken. It is well documented in their book, but in reality some of its features do not work [anymore]. These broken features include single-field requests (either GET or PUT), field-collection requests like /contact/ID/emails (again, regardless of HTTP method), and as you noticed image fetching. It is still possible to create new contact or remove an existing one, because multiple-contacts and single-contact endpoints are alive. But it is not possible to edit an existing contact or to get contact image.

In addition, this API doesn't set any CORS headers which makes it impossible to use this API from the browser directly. (How to fix from Yahoo side: add Access-Control-Allow-Origin: * header to API endpoints. How to workaround from client side: use your backend as a proxy)

There is a page, linked from their developers' main page, which claims to be the documentation for a current version of Yahoo Social API, but this page is broken as well. It has links to "documentation" and "forum", both with empty href leading to the same page. And the only working link is to the aforementioned REST API book which is labelled "Legacy API".

Summary:

  • There is probably some new version of API but it is not documented anywhere, the page designated for documentation is broken.
  • There is a good docs for "older" version of API, but the API itself is not fully functional.
  • Web version of Contacts app (in Yahoo Mail) uses its own backend, not the public API, and requests are protected with cookies rather than OAuth keys. Hence we cannot easily use this API, although it is probably the only working way to get the required information.

UPD: asked them in Twitter and Uservoice, please vote. Hopefully someone will finally look into this issue.

like image 75
MarSoft Avatar answered Nov 09 '22 02:11

MarSoft