0

How to decode this image name (with extension)

<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/xxx@test.com/2d4aaf09b20bb7"/>
  <link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/xxx@test.com/full/2d4aaf09b20bb7"/>
  <link rel="edit" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/xxx@test.com/full/2d4aaf09b20bb7"/>
SagarPPanchal
  • 9,839
  • 6
  • 34
  • 62
  • What do yo mean by "decode" ? It's a URL, at which you can display/download the image. – David Aug 19 '14 at 09:18
  • @David yes, i know its a url! but the filname it's giving in the encoded form! `2d4aaf09b20bb7` – SagarPPanchal Sep 01 '14 at 12:09
  • There is no filename. An image does not need a name to be accessed from a browser. Just access the url to download the image, no need do decode anything. – David Sep 01 '14 at 12:37
  • @David yes i tried a lot to access this url `https://www.google.com/m8/feeds/contacts/xxx@test.com/full/2d4aaf09b20bb7` but its already broken – SagarPPanchal Sep 01 '14 at 12:45
  • You should explain what you mean by broken. What is the error ? – David Sep 01 '14 at 12:46
  • @David i found '401. That's an error. There was an error in your request. That's all we know.' – SagarPPanchal Sep 01 '14 at 12:58
  • @SagarPPanchal - Were you able to download the file through the url with access token? I am getting successful but a bye code response. Not sure how to convert and get the jpg file. – Sk. Irfan Feb 23 '18 at 11:11

2 Answers2

0

You can't take the URL and paste it in the browser (if I understand the question correctly). You would have to send a authorized GET request as mentioned in the Google Contact API guide here.

To retrieve a contact's photo, send an authorized GET request to the contact's photo link URL.

So essentially, you would use the same tokens as you used to receive the contact details (I am assuming you are using GData Contact API).

Akshay Gaur
  • 2,235
  • 21
  • 26
-1

You are getting an HTTP 401 error, which means that you are not authorized to access the image (more info here).

Are you accessing the image url directly with the browser or with your API client ? You need to provide a proper OAuth token to access the image.

David
  • 5,481
  • 2
  • 20
  • 33