1

I've encountered an issue with LinkedIn share API. I am working on a iPhone project, testing my application on iOS 4.0, 5.0. I used this project as an example:

[https://github.com/synedra/LinkedIn-OAuth-Sample-Client][1]

I thought I am a genius after successfully implementing this API not only for sharing an update, but also with following format(like shown in [https://developer.linkedin.com/documents/share-api][1]):

<?xml version="1.0" encoding="UTF-8"?>
<share>
  <comment>83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] http://bit.ly/cCpeOD</comment>
  <content>
     <title>Survey: Social networks top hiring tool - San Francisco Business Times</title>
     <submitted-url>http://sanfrancisco.bizjournals.com/sanfrancisco/stories/2010/06/28/daily34.html</submitted-url>
     <submitted-image-url>http://images.bizjournals.com/travel/cityscapes/thumbs/sm_sanfrancisco.jpg</submitted-image-url>
  </content>
  <visibility>
     <code>anyone</code>
  </visibility>
</share>

Following advices and examples, I was preparing a JSON string that i was using. So, i got this:

{
  "visibility":
  {
        "code":"anyone"
  },
  "comment":"Asd",
  "content":
  {
        "submitted-url":"http://google.com",
        "title":"googloo",
        "submitted-image-url":"http://pikci.ru/images/img_srchttpwwwcomputerrivercomimagessamsung-chat-335-qwer.jpg"
  }
}

Well, with this data inside, it works like a charm. the update is with image, clickable title and stuff. Perfect.

Then, i tried to put a link(because i really needed in purpose of my project) with a Equal sign in it: "=", like for example we have http://www.google.md/#q=Nicolas+Steno&ct=steno12-hp&oi=ddle&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=8c5a975d815425a&biw=1920&bih=881

Well, if we use this link in submitted-url, and send it, the LinkedIn will receive it, and even will give us a response. But it WONT update to the new status! It's a huge bug for my application, because the share won't work, but more than a half of the shared links will have equal sign in it. It is the third day when i'm fighting with it. I was trying different coding functions, different "smarty-pants" moves, but failed.

If anyone has a clue about what is going on here, I will hugely appreciate it...

Dumoko
  • 2,614
  • 3
  • 25
  • 34

1 Answers1

2

When I post this body to LinkedIn I get my status updated:

{
    "comment": "Posting from the API using JSON", 
    "content": {
         "submitted-url": 
              "http://www.google.md/#q=Nicolas+Steno&ct=steno12-hp&oi=ddle&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=8c5a975d815425a&biw=1920&bih=881"
     }, "visibility": {
         "code": "anyone"
     }
}

However, the link itself doesn't resolve correctly. It's likely that something about that URL is tripping up our link shortener - we're working on fixing these issues but in the meantime you could use something like the Google URL shortener URL:

body = {"longUrl": article['articleContent']['resolvedUrl']}
resp,content = http.request("https://www.googleapis.com/urlshortener/v1/url?key=xxx","POST",body=simplejson.dumps(body),headers={"Content-Type":"application/json"})
googleresponse = simplejson.loads(content)

... and then share that to LinkedIn. I realize it's a suboptimal solution, but until the share function gets fixed to handle these URLs it should get you going.

Kirsten Jones
  • 2,681
  • 1
  • 17
  • 20
  • Kirsten, i appreciate a lot your answer! Now i see that the problem could be deeper. When i decided to hardcode the request you say that works for you, I've noticed that i receive a {"_total": 0} response, and the status is not updated. I know that android guys don't have any problems with their wrapper.They are sending the same links and they're fine. Then if we assume that the problem is caused by me, the way how i make requests and post them, may i ask you smth? Kirsten, could you please try to give me a hint about where the problem can be buried in this case? Is there a way to send XML?=/ – Dumoko Jan 12 '12 at 08:32
  • You can send XML, the information is on the page about the share API. However, if you have a working client on android what I'd do is sniff the http traffic and see what the difference is between your request and the working request. If you have a macintosh, you can share your internet connection over wi-fi and sniff using HTTPScoop, then check headers, URL, body and see what's different. Good luck! – Kirsten Jones Jan 13 '12 at 00:53