hexgnu / linkedin

Ruby wrapper for the LinkedIn API
http://rdoc.info/gems/linkedin
MIT License
756 stars 407 forks source link

(400): 'submitted-url' and 'media-key' can not be both empty #258

Closed jbolles5 closed 8 years ago

jbolles5 commented 8 years ago

I have recently started getting this error when using the add_company_share method. I am passing 'submitted-url' and 'submitted-image-url' into the content section, as indicated by the documentation here: https://developer.linkedin.com/docs/company-pages#company_share

For the life of me I can't find media-key anywhere in the documentation. What am I missing here? Any help would be appreciated.

Actual post code:

result = client.add_company_share(published_post.channel_account.channel_id, { comment: scheduled_post.post_text, content: { 'submitted-image-url' => scheduled_post.post_image.url,  'submitted-url' => scheduled_post.link  } })
hexgnu commented 8 years ago

Hrm... weird I haven't heard of media-key either.

Have you tried setting media-key to blank?

jbolles5 commented 8 years ago

I just set media-key to blank and the post went through. Odd. Closing this issue, thanks for the help.

danielbonnell commented 8 years ago

I just started encountering this problem in my app. I've set 'media-key' => '' in my options hash but I still get the error whenever I'm not submitting a submitted-url, even if I just set 'submitted-url' => '' in my hash. This is strange because LinkedIn doesn't require you to include a link when posting a share through their native UI.

jbolles5 commented 8 years ago

As best I can tell, you must include Submitted URL, Image URL, and media key in order to post anything that is not just a plain text post. 

Justin Bolles connectthink 

O | 317.682.0282 

C | 317.201.4516 

www.connectthink.com

On Mon, Nov 2, 2015 at 12:33 PM, Daniel Bonnell notifications@github.com wrote:

I just started encountering this problem in my app. I've set 'media-key => ''in my options hash but I still get the error whenever I'm not submitting asubmitted-url, even if I just set'submitted-url' => ''` in my hash. This is strange because LinkedIn doesn't require you to include a link when posting a share through their native UI.

Reply to this email directly or view it on GitHub: https://github.com/hexgnu/linkedin/issues/258#issuecomment-153094280

danielbonnell commented 8 years ago

So do I need to be submitting shares without a media-url as a comment?

sagar2agrawal commented 6 years ago

yes, that will work