Update LinkedIn connector to use v2 APIs#1460
Conversation
srenatus
left a comment
There was a problem hiding this comment.
🎉 Thank you! Some comments from my mobile, I'll elaborate later if need be.
c995fe3 to
08966e8
Compare
|
Thanks @srenatus for checking. I have added a commit to unmarshal into a nested struct. Hope that addresses both your comments? |
There was a problem hiding this comment.
I'd prefer non-named return values, but that's mostly a matter of taste and not consistent even within this code base. So, let's leave it as is, since we're not using naked returns, there's little harm done. 😉
There was a problem hiding this comment.
❓ Is this validation good enough? From glancing at the API docs (thanks for including the links, much appreciated!), handle~ could be missing because something (no idea what!) went wrong...?
With the current code, that would mean email remains "" (unassigned) and err would still be nil because of the way JSON unmarshaling works. (Its errors aren't for cases where expected fields aren't found, but rather more low-level stuff. If you try to unmarshal {this:"garba"ge}} for example.)
💡 looks like we'd catch that below, in this check -- I think I'd propose moving that into this helper method: "if primaryEmail returns a non-nil error, it has successfully retrieved the email address" sounds like a decent property for a function with that name. What do you think?
There was a problem hiding this comment.
Yes, agree. Will make that change in a bit.
|
Hi @srenatus, I have now made the change to check for |
|
@tanmaykm thank you! would you mind squashing the commits? 😃 |
This updates LinkedIn connector to use the more recent v2 APIs. Necessary because v1 APIs are not able to retrieve email ids any more with the default permissions. The API URLs are now different. Fetching the email address is now a separate call, made after fetching the profile details. The `r_basicprofile` permission is not needed any more, and `r_liteprofile` (which seems to be the one assigned by default) is sufficient. The relevant API specifications are at: - https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api - https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/primary-contact-api - https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq#how-do-i-retrieve-the-members-email-address
|
Yup, done! |
Update LinkedIn connector to use v2 APIs
This updates LinkedIn connector to use the more recent v2 APIs. Necessary because v1 APIs are not able to retrieve email ids any more with the default permissions.
The API URLs are now different. Fetching the email address is now a separate call, made after fetching the profile details. The r_basicprofile permission is not needed any more, and r_liteprofile (which seems to be the one assigned by default) is sufficient.
The relevant API specifications are at:
https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/profile-api
https://docs.microsoft.com/en-us/linkedin/shared/integrations/people/primary-contact-api
https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq#how-do-i-retrieve-the-members-email-address
This updates LinkedIn connector to use the more recent v2 APIs. Necessary because v1 APIs are not able to retrieve email ids any more with the default permissions.
The API URLs are now different. Fetching the email address is now a separate call, made after fetching the profile details. The
r_basicprofilepermission is not needed any more, andr_liteprofile(which seems to be the one assigned by default) is sufficient.The relevant API specifications are at:
fixes #1452