When i use the LinkedIn API to get profile information, the picture urls are sometime not accessible.
I get this response
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>403 - Forbidden</title> </head> <body> 403 - Forbidden
Upon further digging I find that LinkedIn returns something like this for original picture url<blockquote>
However, when I go to LinkedIn.com and checkout the URL of the picture of the profile it looks something like this<blockquote>
Does anyone else face this issue? What is going on here?
I also verified that I'm using the correct scope "r_basicprofile"Answer1:
Rather than requesting the original picture-url, you can make a request to a resized picture-url. For example,
where size can be 100, 200, or 400.Answer2:
I looked at the URL of my picture of my In Public profile and the one returned from the API.
The picture URL in the XML returned after the "?" for params v and t had "& ;" instead of "&":
e.g. <a href="https://media.licdn.com/.../profile-displayphoto-shrink_200_200/0?e=152800" rel="nofollow">https://media.licdn.com/.../profile-displayphoto-shrink_200_200/0?e=152800</a>"&";v=beta"&";t=LJTrw_oj9npH06X1u0HjQ
replacing it with sth like <strong>pictureURL = pictureURL.replaceAll("& ;","&");</strong> fixed the issue for me. Hope this helps
note that the there is an extra space between & and ; it would have formatted otherwise.