linkedin-oauth2 icon indicating copy to clipboard operation
linkedin-oauth2 copied to clipboard

Using example in Readme `add_share(comment: 'Hi') returns 400

Open gotoAndBliss opened this issue 11 years ago • 8 comments

There is something incorrect about the syntax.

api.shares
=> {"total"=>0}

But if I do

api.add_share(content: "hi")
Faraday::ClientError: the server responded with status 400

But respectfully so, LinkedIn API is looking for comment not content , and I were to do

api_add_share(comment: 'hi')

It produces the same error. Has anyone gotten add_share to work recently?

gotoAndBliss avatar Sep 22 '14 15:09 gotoAndBliss

This is fixed here https://github.com/emorikawa/linkedin-oauth2/pull/12

gotoAndBliss avatar Sep 22 '14 16:09 gotoAndBliss

I'm still having this issue in add_share. Do I miss something?

ghost avatar Mar 05 '15 06:03 ghost

I am getting the same issue as well

rahult avatar Mar 30 '15 11:03 rahult

I got it working with comment instead of content

api.add_share(comment: 'Hi!')

By using content instead of comment I was getting this error in faraday

https://gist.github.com/rahult/e219f192b495ae954f03

rahult avatar Mar 30 '15 13:03 rahult

I'm getting the same issue, I tried with comment and content, and in both cases I'm getting 400. The w_share is checked on my Linkedin app. Any thoughts?

jandresrodriguez avatar Nov 28 '15 21:11 jandresrodriguez

The problem reported here is fixed in the Git repo, but the author has not updated the gem on rubygems.org :(

To work around this you can install the gem like so in your Gemfile: gem 'linkedin-oauth2', github: 'emorikawa/linkedin-oauth2', ref: 'ceb63460b8b45b7e00766ae3a4c3e361d76c6ffc'

The above is referencing the last git commit, you should double check it's still the last commit.

Also, be sure you use the syntax api.add_share(comment: 'Hi!') as stated above. In addition to the comment property, you can include a content property, but that content is a hash describing the content you are sharing. Check the LinkedIn Share API for the details.

sunild avatar Jan 10 '16 19:01 sunild

Hey, just bumping this. @sunild 's solution works for me, but it would be really great to get the rubygems page updated so that our gemfiles don't have to be pegged to a particular ref in case there are any updates. @emorikawa ? -- (And thanks for a very helpful gem!)

akrulwich avatar Aug 16 '16 16:08 akrulwich

Hey, I have followed @sunild suggestion but no success, I am still getting ``on_complete': the server responded with status 400 ` Can you please give me a simple code example of authenticating and sharing a comment/content

Thank you very much

nelioini avatar Nov 11 '17 12:11 nelioini