Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gotoAndBliss opened this issue Sep 22, 2014 · 8 comments
Open

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

gotoAndBliss opened this issue Sep 22, 2014 · 8 comments

Comments

@gotoAndBliss
Copy link

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
Copy link
Author

This is fixed here #12

@ghost
Copy link

ghost commented Mar 5, 2015

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

@rahult
Copy link

rahult commented Mar 30, 2015

I am getting the same issue as well

@rahult
Copy link

rahult commented Mar 30, 2015

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
Copy link

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
Copy link

sunild commented Jan 10, 2016

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants