Google API : Getting a Contacts Photo

后端 未结 4 1955
闹比i
闹比i 2021-02-14 09:02

I\'ve been able to retrieve everything but the contacts photo by following the API.

I can get the img url as well as the gd:etag from the xml returned. Below is the Goog

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-14 09:34

    First, you need to make a authorized GET to that url, i.e., in the Authorization header you have to put "OAuth " + AccessToken. Also, I haven't tried but, as Savil has said, with the Access Token as a Query Parameter, you can also achieve the same.

    In any case, Google responds you with the bytes of the image, so you cannot display as is. You'll need either save the byte array to a file in your server (I don't think this to be a good solution) or find another way to display the photo

    If you want to read more about it, here is Google's documentation about contact photos

    This is a rather old question, but nevertheless I hope this can be helpful

提交回复
热议问题