Skip to content

Update examples to use /userinfo and /posts endpoints#73

Open
ZLeventer wants to merge 2 commits intolinkedin-developers:mainfrom
ZLeventer:fix/update-examples
Open

Update examples to use /userinfo and /posts endpoints#73
ZLeventer wants to merge 2 commits intolinkedin-developers:mainfrom
ZLeventer:fix/update-examples

Conversation

@ZLeventer
Copy link
Copy Markdown

Summary

  • get_profile.py: Replace deprecated /me endpoint with /userinfo, update field names to OpenID Connect claims (sub, given_name, family_name, picture, etc.), and update required scopes from r_liteprofile to openid + profile
  • create_posts.py: Replace /me with /userinfo, use sub instead of id for the person URN, and remove the legacy /ugcPosts example entirely (endpoint is deprecated) — only the versioned /posts API remains

These changes align the examples with the current LinkedIn API, where the v2 /me endpoint and /ugcPosts have been deprecated in favor of OpenID Connect's /userinfo and the versioned /posts API respectively.

Fixes #60 — fresh take on the same changes proposed in the stale PR from Apr 2024.

Test plan

  • Verify get_profile.py successfully calls /userinfo and returns OpenID Connect claims
  • Verify create_posts.py creates a post via /posts using the sub field from /userinfo
  • Confirm no references to deprecated /me or /ugcPosts remain in examples

ZLeventer and others added 2 commits April 23, 2026 21:10
…g from batch create response

When the JSON response lacks an "elements" key, json_data.get() returns
None, which cannot be iterated. Default to an empty list instead, matching
the pattern already used by BatchFinderResponseFormatter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…edin-developers#29)

Python's double underscore prefix triggers name mangling, which is
inappropriate for regular private functions and methods. Renamed all
non-dunder `__` prefixed functions/methods to single underscore `_`
across encoder.py, decoder.py, and client.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant