Closed JoshvaR88 closed 10 years ago
How to send the invitation using by people id, i have tried but it throw some error like this _Invalid authorization name/value {x-li-auth-token}/{NAMESEARCH:tdLy}
Code following message = { "recipients" => {"values" => [{"person" => {"_path" => "/people/tp2Z82Xa_I","first-name" => "Dev","last-name" => "ruby"}}]}, "subject" => "Invitation to connect.","body" => "hi Ruby","item-content" => {"invitation-request" => {"connect-type" => "friend","authorization" => {"name" => "x-li-auth-token","value" => "NAME_SEARCH:tdLy"}}}}
message = { "recipients" => {"values" => [{"person" => {"_path" => "/people/tp2Z82Xa_I","first-name" => "Dev","last-name" => "ruby"}}]}, "subject" => "Invitation to connect.","body" => "hi Ruby","item-content" => {"invitation-request" => {"connect-type" => "friend","authorization" => {"name" => "x-li-auth-token","value" => "NAME_SEARCH:tdLy"}}}}
` consumer_options = { :request_token_path => "/uas/oauth/requestToken?scope=w_messages", :access_token_path => "/uas/oauth/accessToken", :authorize_path => "/uas/oauth/authorize", :api_host => "https://api.linkedin.com", :auth_host => "https://www.linkedin.com" } consumer = OAuth::Consumer.new('l7z5j24sad23a5s47','h4JWc3423eXsdkvXCEwtWxrOM',consumer_options) access_token=OAuth::AccessToken.new(consumer,"21ec06cr6c6-e297-4884-885c-7ara317c4f19", "1br985t5-4805-4016-8f6e-2a13t9hce293")
access_token.post("https://api.linkedin.com/v1/people/~/mailbox", MultiJson.dump(message), "Content-Type" => "application/json").body`
the name should be NAME_SEARCH and the value should be tdLy instead of what you have above. You have to split the value out of the oauth headers.
How to send the invitation using by people id, i have tried but it throw some error like this _Invalid authorization name/value {x-li-auth-token}/{NAMESEARCH:tdLy}
Code following
message = { "recipients" => {"values" => [{"person" => {"_path" => "/people/tp2Z82Xa_I","first-name" => "Dev","last-name" => "ruby"}}]}, "subject" => "Invitation to connect.","body" => "hi Ruby","item-content" => {"invitation-request" => {"connect-type" => "friend","authorization" => {"name" => "x-li-auth-token","value" => "NAME_SEARCH:tdLy"}}}}
` consumer_options = { :request_token_path => "/uas/oauth/requestToken?scope=w_messages", :access_token_path => "/uas/oauth/accessToken", :authorize_path => "/uas/oauth/authorize", :api_host => "https://api.linkedin.com", :auth_host => "https://www.linkedin.com" } consumer = OAuth::Consumer.new('l7z5j24sad23a5s47','h4JWc3423eXsdkvXCEwtWxrOM',consumer_options) access_token=OAuth::AccessToken.new(consumer,"21ec06cr6c6-e297-4884-885c-7ara317c4f19", "1br985t5-4805-4016-8f6e-2a13t9hce293")
access_token.post("https://api.linkedin.com/v1/people/~/mailbox", MultiJson.dump(message), "Content-Type" => "application/json").body`