emorikawa / linkedin-oauth2

Ruby wrapper for the LinkedIn OAuth2 API
Other
70 stars 86 forks source link

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

Open gotoAndBliss opened 10 years ago

gotoAndBliss commented 10 years ago

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 commented 10 years ago

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

ghost commented 9 years ago

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

rahult commented 9 years ago

I am getting the same issue as well

rahult commented 9 years ago

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

jandresrodriguez commented 9 years ago

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?

sunild commented 8 years ago

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.

akrulwich commented 8 years ago

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!)

nelioini commented 7 years ago

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