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

send_message returns 400 error always. #22

Open
nicooga opened this issue Dec 3, 2014 · 5 comments
Open

send_message returns 400 error always. #22

nicooga opened this issue Dec 3, 2014 · 5 comments

Comments

@nicooga
Copy link

nicooga commented Dec 3, 2014

Just in case, yes I have configured the gem with my app_id, app_secret, and I'm getting user tokens through the oauth2 login process using omniauth.
Other endpoints, like #connections are working fine and returning data, but not #send_message.

client = LinkedIn::API.new User.find(8).linkedin_oauth2_token
client.connections
=> [stuff, stuff, ...]
user_id = client.connections.all.find { |c| c.last_name == 'Pitt' }.id
client.send_message 'test', 'asdf', [user_id]
=> Faraday::ClientError: the server responded with status 400
from /home/nicolas/.rvm/gems/ruby-2.1.1/gems/faraday-0.9.0/lib/faraday/response/raise_error.rb:13:in `on_complete'

Is possible #send_message is outdated? Can I put Faraday on verbose mode so I can debug this?

@dgp
Copy link

dgp commented Dec 8, 2014

Me too got same bug. any update?

@codeboxanvo
Copy link

The same to mine, others work well but #send_message

@dgp
Copy link

dgp commented Dec 24, 2014

@codeboxanvo I used linkedin rest API it works for me. There is problem in this gem for sending message.
Here is my code
Used HTTParty Gem to send message

data = {subject: 'subject', body: 'body', recipients: {values: [uid].map{|profile_path| {person: {_path: "/people/#{profile_path}"}} } }}

HTTParty.post("https://api.linkedin.com/v1/people/~/mailbox", headers: { 'Content-Type' => 'application/json'}, query: {oauth2_access_token: 'xxxxxxxxxxxxxxx'}, body: data.to_json)

@codeboxanvo
Copy link

@dgp
Copy link

dgp commented Dec 24, 2014

@codeboxanvo yes same format but some data is missing in request. tats y it return 400.
You can look the error status.
https://developer.linkedin.com/documents/error-codes

takayuki-sato added a commit to takayuki-sato/linkedin-oauth2 that referenced this issue Feb 13, 2015
takayuki-sato added a commit to takayuki-sato/linkedin-oauth2 that referenced this issue Feb 17, 2015
takayuki-sato added a commit to takayuki-sato/linkedin-oauth2 that referenced this issue Feb 17, 2015
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

3 participants