linkedin icon indicating copy to clipboard operation
linkedin copied to clipboard

Update LinkedIn::Api::ShareAndSocialStream#add_share for Api v2

Open dsandstrom opened this issue 6 years ago • 12 comments

  • The path changed to /v2/ugcPosts
  • More attributes are required in the payload

Along with sending over the comment, you must send the user's "urn"

Example (updated):

client = LinkedIn::Client.new
client.authorize_from_access(token)
client.v2_add_share(urn, { comment: 'hi' })

https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context

dsandstrom avatar Feb 23 '19 02:02 dsandstrom

@dsandstrom if you want to write a test for this I can review this and merge it and also cut a new gem.

Thanks!

hexgnu avatar Feb 23 '19 17:02 hexgnu

Well the problem is this change breaks all other endpoints as they have not been updated for LinkedIn's API v2. I just wanted to show other people what I got working.

dsandstrom avatar Feb 26 '19 20:02 dsandstrom

We could do something like Linkedin::V2.add_share too. That way it wouldn't break for others

hexgnu avatar Feb 27 '19 00:02 hexgnu

Not sure how you want to keep v2 methods separate, but this allows v1 endpoints to still work. You said to do "something like Linkedin::V2.add_share", but that doesn't really make sense since we run the methods on the LinkedIn::Client. A possibility is to add a LinkedIn::V2::Client, then include the v2 methods into that class.

dsandstrom avatar Mar 13 '19 00:03 dsandstrom

nice work! I just put a few comments, mostly nitpicks and question type things.

I'm wondering if we should do something besides the prefixing of the methods for v2_* requests.

I think it's ok, it just feels a bit weird is all since v1 is mostly deprecated at this point.

hexgnu avatar Apr 08 '19 15:04 hexgnu

Prefixing with v2 was just temporary. A V2 module needs to be set up. See https://github.com/hexgnu/linkedin/pull/274#issuecomment-472236744

dsandstrom avatar Apr 08 '19 16:04 dsandstrom

Yea Linkedin::V2::Client makes sense. if you want to do that.

hexgnu avatar Apr 08 '19 16:04 hexgnu

@hexgnu @dsandstrom Just a heads up I added the email endpoint in a fork and opened a PR on @dsandstrom fork. https://github.com/dsandstrom/linkedin/pull/1. My company needs it for our auth flow.

addbrick avatar Apr 18 '19 22:04 addbrick

@hexgnu @dsandstrom I ended up adding a little more to my pr it now includes the additions:

  • Default fields to the /me endpoint, which are now required by LinkedIn
  • Support for the v2 email address endpoint
  • Parsing of the raw JSON responses from me and email endpoints
  • Specs covering what was added above

https://github.com/dsandstrom/linkedin/pull/1

Meant to say this the first time, but I did not address any of the outstanding pr comments.

addbrick avatar Apr 19 '19 01:04 addbrick

If you all want to combine forces feel free to do so :) will gladly review and merge in.

hexgnu avatar Apr 22 '19 20:04 hexgnu

@dsandstrom @addbrick - great work! Thank you for doing this! If you all can get this in I can't wait to use it :)

malissa avatar Apr 24 '20 14:04 malissa

Again happy to help merge this stuff in I just don't work with the linkedin API anymore so I'd be flying blind here :smile:.

hexgnu avatar Apr 24 '20 21:04 hexgnu