86703

Linkedin API - Picture-urls::original - forbidden 403 error

Question:

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

</body> </html>

Upon further digging I find that LinkedIn returns something like this for original picture url

<blockquote>

.../profile-originalphoto-shrink_900_1200...

</blockquote>

However, when I go to LinkedIn.com and checkout the URL of the picture of the profile it looks something like this

<blockquote>

.../profile-originalphoto-shrink_800_800...

</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,

picture-url;size=400

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 "&amp ;" 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>"&amp";v=beta"&amp";t=LJTrw_oj9npH06X1u0HjQ

replacing it with sth like <strong>pictureURL = pictureURL.replaceAll("&amp ;","&");</strong> fixed the issue for me. Hope this helps

note that the there is an extra space between &amp and ; it would have formatted otherwise.

Recommend

  • PrimeFaces p:fileUpload does not invoke method
  • Creating a basic bar chart in d3js
  • CSS - Left align the last row of images in a centered div
  • Countdown timer not working with gmt time
  • SVG is not rendering in IE 10 with Doctype HTML 4
  • HTML & XHTML id attribute question
  • Embed image to email message in System.Web.Mail.MailMessage
  • Updating ASP.NET UpdatePanel during processing loop
  • PHP Session check not working when i redirect from another page
  • ModelAndView object not returned to jsp
  • Login form issue with spring security 2.0.7 and spring 2.5
  • Dynamic Event Handler not Firing
  • a:first-child modifying all links within my list
  • :hover CSS is not working?
  • How to forcefully download .csv file instead of getting in open on browser in html
  • Hibernate - Cannot connect to DB
  • Separate ID and Class for JS and CSS
  • Feature detection of foreignObject in SVG
  • XSD with multi occurrences unordered
  • garbled css name when styling within UiBinder
  • How to open html table in xls on click of a button
  • How can I include If-None-Match header in HttpRequestMessage
  • Parse a date string in a specific locale (not timezone!)
  • Jetty 9 HashLoginService
  • Read a local file using javascript
  • ImageMagick, replace semi-transparent white with opaque white
  • Syntax for setting draggablecursor property in google maps api
  • Seeking advice on Jetty HttpClient Hang
  • does jqgrid support a multiple checkbox list for editing
  • Cannot connect to cassandra from Spark
  • Display issues when we change from one jquery mobile page to another in firefox
  • Optimizing database types to compact database (SQLite)
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • Unanticipated behavior
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy