LinkedIn Component

Available as of Camel 2.14

The LinkedIn component provides access to all of LinkedIn REST APIs documented at https://developer.linkedin.com/rest

LinkedIn uses OAuth2.0 for all client application authentication. In order to use camel-linkedin with your account, you'll need to create a new application for LinkedIn at https://www.linkedin.com/secure/developer. The LinkedIn application's client id and secret will allow access to LinkedIn REST APIs which require a current user. A user access token is generated and managed by component for an end user. Alternatively the Camel application can register an implementation of org.apache.camel.component.linkedin.api.OAuthSecureStorage to provide an org.apache.camel.component.linkedin.apiOAuthToken OAuth token.

Maven users will need to add the following dependency to their pom.xml for this component:

URI format

Endpoint prefix can be one of:

  • comments
  • companies
  • groups
  • jobs
  • people
  • posts
  • search

LinkedInComponent

The LinkedIn Component can be configured with the options below. These options can be provided using the component's bean property configuration of type org.apache.camel.component.linkedin.LinkedInConfiguration.

OptionTypeDescription
clientIdStringLinkedIn application client ID
clientSecretStringLinkedIn application client secret
httpParamsjava.util.MapCustom HTTP params, for example proxy host and port, use constants from AllClientPNames
lazyAuthbooleanFlag to enable/disable lazy OAuth, default is true. when enabled, OAuth token retrieval or generation is not done until the first REST call
redirectUriStringApplication redirect URI, although the component never redirects to this page to avoid having to have a functioning redirect server. So for testing one could use https://localhost
scopesorg.apache.camel.component.linkedin.api.OAuthScope[]List of LinkedIn scopes as specified at https://developer.linkedin.com/documents/authentication#granting
secureStorageorg.apache.camel.component.linkedin.api.OAuthSecureStorageCallback interface for providing an OAuth token or to store the token generated by the component. The callback should return null on the first call and then save the created token in the saveToken() callback. If the callback returns null the first time, a userPassword MUST be provided
userNameStringLinkedIn user account name, MUST be provided
userPasswordStringLinkedIn account password

Producer Endpoints:

Producer endpoints can use endpoint prefixes followed by endpoint names and associated options described next. A shorthand alias can be used for some endpoints. The endpoint URI MUST contain a prefix.

Endpoint options that are not mandatory are denoted by []. When there are no mandatory options for an endpoint, one of the set of [] options MUST be provided. Producer endpoints can also use a special option inBody that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message.

Any of the endpoint options can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelLinkedIn.<option>. Note that the inBody option overrides message header, i.e. the endpoint option inBody=option would override a CamelLinkedIn.option header.

For more information on the endpoints and options see LinkedIn REST API documentation at https://developer.linkedin.com/rest

Endpoint prefix comments

The following endpoints can be invoked with the prefix comments as follows:

EndpointShorthand AliasOptionsResult Body Type
getCommentcommentcomment_id, fieldsorg.apache.camel.component.linkedin.api.model.Comment
removeCommentcommentcomment_id 
URI Options for comments
NameType
comment_idString
fieldsString

Endpoint prefix companies

The following endpoints can be invoked with the prefix companies as follows:

EndpointShorthand AliasOptionsResult Body Type
addCompanyUpdateCommentcompanyUpdateCommentcompany_id, update_key, updatecomment 
addCompanyUpdateCommentAsCompanycompanyUpdateCommentAsCompanycompany_id, update_key, updatecomment 
addSharesharecompany_id, share 
getCompaniescompaniesemail_domain, fields, is_company_adminorg.apache.camel.component.linkedin.api.model.Companies
getCompanyByIdcompanyByIdcompany_id, fieldsorg.apache.camel.component.linkedin.api.model.Company
getCompanyByNamecompanyByNamefields, universal_nameorg.apache.camel.component.linkedin.api.model.Company
getCompanyUpdateCommentscompanyUpdateCommentscompany_id, fields, secure_urls, update_keyorg.apache.camel.component.linkedin.api.model.Comments
getCompanyUpdateLikescompanyUpdateLikescompany_id, fields, secure_urls, update_keyorg.apache.camel.component.linkedin.api.model.Likes
getCompanyUpdatescompanyUpdatescompany_id, count, event_type, fields, startorg.apache.camel.component.linkedin.api.model.Updates
getHistoricalFollowStatisticshistoricalFollowStatisticscompany_id, end_timestamp, start_timestamp, time_granularityorg.apache.camel.component.linkedin.api.model.HistoricalFollowStatistics
getHistoricalStatusUpdateStatisticshistoricalStatusUpdateStatisticscompany_id, end_timestamp, start_timestamp, time_granularity, update_keyorg.apache.camel.component.linkedin.api.model.HistoricalStatusUpdateStatistics
getNumberOfFollowersnumberOfFollowerscompanySizes, company_id, geos, industries, jobFunc, senioritiesorg.apache.camel.component.linkedin.api.model.NumFollowers
getStatisticsstatisticscompany_idorg.apache.camel.component.linkedin.api.model.CompanyStatistics
isShareEnabled company_idorg.apache.camel.component.linkedin.api.model.IsCompanyShareEnabled
isViewerShareEnabled company_idorg.apache.camel.component.linkedin.api.model.IsCompanyShareEnabled
likeCompanyUpdate company_id, isliked, update_key 
URI Options for companies

If a value is not provided for one of the option(s) [companySizes, count, email_domain, end_timestamp, event_type, geos, industries, is_company_admin, jobFunc, secure_urls, seniorities, start, start_timestamp, time_granularity] either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value(s) will only be used if other options do not satisfy matching endpoints.

NameType
companySizesjava.util.List
company_idLong
countLong
email_domainString
end_timestampLong
event_typeorg.apache.camel.component.linkedin.api.Eventtype
fieldsString
geosjava.util.List
industriesjava.util.List
is_company_adminBoolean
islikedorg.apache.camel.component.linkedin.api.model.IsLiked
jobFuncjava.util.List
secure_urlsBoolean
senioritiesjava.util.List
shareorg.apache.camel.component.linkedin.api.model.Share
startLong
start_timestampLong
time_granularityorg.apache.camel.component.linkedin.api.Timegranularity
universal_nameString
update_keyString
updatecommentorg.apache.camel.component.linkedin.api.model.UpdateComment

Endpoint prefix groups

The following endpoints can be invoked with the prefix groups as follows:

EndpointShorthand AliasOptionsResult Body Type
addPostpostgroup_id, post 
getGroupgroupgroup_idorg.apache.camel.component.linkedin.api.model.Group
URI Options for groups
NameType
group_idLong
postorg.apache.camel.component.linkedin.api.model.Post

Endpoint prefix jobs

The following endpoints can be invoked with the prefix jobs as follows:

EndpointShorthand AliasOptionsResult Body Type
addJobjobjob 
editJob job, partner_job_id 
getJobjobfields, job_idorg.apache.camel.component.linkedin.api.model.Job
removeJobjobpartner_job_id 
URI Options for jobs
NameType
fieldsString
joborg.apache.camel.component.linkedin.api.model.Job
job_idLong
partner_job_idLong

Endpoint prefix people

The following endpoints can be invoked with the prefix people as follows:

EndpointShorthand AliasOptionsResult Body Type
addActivityactivityactivity 
addGroupMembershipgroupMembershipgroupmembership 
addInviteinvitemailboxitem 
addJobBookmarkjobBookmarkjobbookmark 
addUpdateCommentupdateCommentupdate_key, updatecomment 
followCompany company 
getConnectionsconnectionsfields, secure_urlsorg.apache.camel.component.linkedin.api.model.Connections
getConnectionsByIdconnectionsByIdfields, person_id, secure_urlsorg.apache.camel.component.linkedin.api.model.Connections
getConnectionsByUrlconnectionsByUrlfields, public_profile_url, secure_urlsorg.apache.camel.component.linkedin.api.model.Connections
getFollowedCompaniesfollowedCompaniesfieldsorg.apache.camel.component.linkedin.api.model.Companies
getGroupMembershipSettingsgroupMembershipSettingscount, fields, group_id, startorg.apache.camel.component.linkedin.api.model.GroupMemberships
getGroupMembershipsgroupMembershipscount, fields, membership_state, startorg.apache.camel.component.linkedin.api.model.GroupMemberships
getJobBookmarksjobBookmarks org.apache.camel.component.linkedin.api.model.JobBookmarks
getNetworkStatsnetworkStats org.apache.camel.component.linkedin.api.model.NetworkStats
getNetworkUpdatesnetworkUpdatesafter, before, count, fields, scope, secure_urls, show_hidden_members, start, typeorg.apache.camel.component.linkedin.api.model.Updates
getNetworkUpdatesByIdnetworkUpdatesByIdafter, before, count, fields, person_id, scope, secure_urls, show_hidden_members, start, typeorg.apache.camel.component.linkedin.api.model.Updates
getPersonpersonfields, secure_urlsorg.apache.camel.component.linkedin.api.model.Person
getPersonByIdpersonByIdfields, person_id, secure_urlsorg.apache.camel.component.linkedin.api.model.Person
getPersonByUrlpersonByUrlfields, public_profile_url, secure_urlsorg.apache.camel.component.linkedin.api.model.Person
getPostspostscategory, count, fields, group_id, modified_since, order, role, startorg.apache.camel.component.linkedin.api.model.Posts
getSuggestedCompaniessuggestedCompaniesfieldsorg.apache.camel.component.linkedin.api.model.Companies
getSuggestedGroupPostssuggestedGroupPostscategory, count, fields, group_id, modified_since, order, role, startorg.apache.camel.component.linkedin.api.model.Posts
getSuggestedGroupssuggestedGroupsfieldsorg.apache.camel.component.linkedin.api.model.Groups
getSuggestedJobssuggestedJobsfieldsorg.apache.camel.component.linkedin.api.model.JobSuggestions
getUpdateCommentsupdateCommentsfields, secure_urls, update_keyorg.apache.camel.component.linkedin.api.model.Comments
getUpdateLikesupdateLikesfields, secure_urls, update_keyorg.apache.camel.component.linkedin.api.model.Likes
likeUpdate isliked, update_key 
removeGroupMembershipgroupMembershipgroup_id 
removeGroupSuggestiongroupSuggestiongroup_id 
removeJobBookmarkjobBookmarkjob_id 
share shareorg.apache.camel.component.linkedin.api.model.Update
stopFollowingCompany company_id 
updateGroupMembership group_id, groupmembership 
URI Options for people

If a value is not provided for one of the option(s) [after, before, category, count, membership_state, modified_since, order, public_profile_url, role, scope, secure_urls, show_hidden_members, start, type] either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value(s) will only be used if other options do not satisfy matching endpoints.

NameType
activityorg.apache.camel.component.linkedin.api.model.Activity
afterLong
beforeLong
categoryorg.apache.camel.component.linkedin.api.Category
companyorg.apache.camel.component.linkedin.api.model.Company
company_idLong
countLong
fieldsString
group_idLong
groupmembershiporg.apache.camel.component.linkedin.api.model.GroupMembership
islikedorg.apache.camel.component.linkedin.api.model.IsLiked
job_idLong
jobbookmarkorg.apache.camel.component.linkedin.api.model.JobBookmark
mailboxitemorg.apache.camel.component.linkedin.api.model.MailboxItem
membership_stateorg.apache.camel.component.linkedin.api.model.MembershipState
modified_sinceLong
orderorg.apache.camel.component.linkedin.api.Order
person_idString
public_profile_urlString
roleorg.apache.camel.component.linkedin.api.Role
scopeString
secure_urlsBoolean
shareorg.apache.camel.component.linkedin.api.model.Share
show_hidden_membersBoolean
startLong
typeorg.apache.camel.component.linkedin.api.Type
update_keyString
updatecommentorg.apache.camel.component.linkedin.api.model.UpdateComment

Endpoint prefix posts

The following endpoints can be invoked with the prefix posts as follows:

EndpointShorthand AliasOptionsResult Body Type
addCommentcommentcomment, post_id 
flagCategory post_id, postcategorycode 
followPost isfollowing, post_id 
getPostpostcount, fields, post_id, startorg.apache.camel.component.linkedin.api.model.Post
getPostCommentspostCommentscount, fields, post_id, startorg.apache.camel.component.linkedin.api.model.Comments
likePost isliked, post_id 
removePostpostpost_id 
URI Options for posts

If a value is not provided for one of the option(s) [count, start] either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value(s) will only be used if other options do not satisfy matching endpoints.

NameType
commentorg.apache.camel.component.linkedin.api.model.Comment
countLong
fieldsString
isfollowingorg.apache.camel.component.linkedin.api.model.IsFollowing
islikedorg.apache.camel.component.linkedin.api.model.IsLiked
post_idString
postcategorycodeorg.apache.camel.component.linkedin.api.model.PostCategoryCode
startLong

Endpoint prefix search

The following endpoints can be invoked with the prefix search as follows:

EndpointShorthand AliasOptionsResult Body Type
searchCompaniescompaniescount, facet, facets, fields, hq_only, keywords, sort, startorg.apache.camel.component.linkedin.api.model.CompanySearch
searchJobsjobscompany_name, count, country_code, distance, facet, facets, fields, job_title, keywords, postal_code, sort, startorg.apache.camel.component.linkedin.api.model.JobSearch
searchPeoplepeoplecompany_name, count, country_code, current_company, current_school, current_title, distance, facet, facets, fields, first_name, keywords, last_name, postal_code, school_name, sort, start, titleorg.apache.camel.component.linkedin.api.model.PeopleSearch
URI Options for search

If a value is not provided for one of the option(s) [company_name, count, country_code, current_company, current_school, current_title, distance, facet, facets, first_name, hq_only, job_title, keywords, last_name, postal_code, school_name, sort, start, title] either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value(s) will only be used if other options do not satisfy matching endpoints.

NameType
company_nameString
countLong
country_codeString
current_companyString
current_schoolString
current_titleString
distanceorg.apache.camel.component.linkedin.api.model.Distance
facetString
facetsString
fieldsString
first_nameString
hq_onlyString
job_titleString
keywordsString
last_nameString
postal_codeString
school_nameString
sortString
startLong
titleString

Consumer Endpoints

Any of the producer endpoints can be used as a consumer endpoint. Consumer endpoints can use Scheduled Poll Consumer Options with a consumer. prefix to schedule endpoint invocation. By default Consumer endpoints that return an array or collection will generate one exchange per element, and their routes will be executed once for each exchange. To change this behavior use the property consumer.splitResults=true to return a single exchange for the entire list or array. 

Message Headers

Any URI option can be provided in a message header for producer endpoints with a CamelLinkedIn. prefix.

Message body

All result message bodies utilize objects provided by the Camel LinkedIn API SDK, which is built using Apache CXF JAX-RS. Producer endpoints can specify the option name for incoming message body in the inBody endpoint parameter.

Use cases

The following route gets user's profile:

The following route polls user's connections every 30 seconds:

The following route uses a producer with dynamic header options. The personId header has the LinkedIn person ID, so its assigned to the CamelLinkedIn.person_id header as follows:

© 2004-2014 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram