Newer Version Available
Recommendations Class
Namespace
Recommendations Methods
The following are methods for Recommendations. All methods are static.
getRecommendationForUser(communityId, userId, action, objectId)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.RecommendationCollection getRecommendationForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, String objectId)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- objectId
- Type: String
- Specifies the object to take action on.
- If action is follow, objectId is a user ID, file ID, or record ID.
- If action is join, objectId is a group ID.
- If action is view, objectId is a user ID, file ID, group ID, record ID, or custom recommendation ID (version 34.0 and later).
Return Value
getRecommendationsForUser(communityId, userId, contextAction, contextObjectId, maxResults)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.RecommendationCollection getRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
Return Value
Usage
If you want to get recommendations based on a recent action performed, such as following a user, use contextAction and contextObjectId together. For example, if you just followed Pam, you specify follow for contextAction and Pam’s user ID for contextObjectId.
This method only recommends users who are followed by people who
follow Pam. In this example, John follows Pam so the method returns a recommendation for you
to follow Suzanne since John also follows Suzanne.
getRecommendationsForUser(communityId, userId, action, contextAction, contextObjectId, maxResults)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.RecommendationCollection getRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
Return Value
Usage
If you want to get recommendations based on a recent action performed, such as following a user, use contextAction and contextObjectId together. For example, if you just followed Pam, you specify follow for contextAction and Pam’s user ID for contextObjectId.
This method only recommends users who are followed by people who
follow Pam. In this example, John follows Pam so the method returns a recommendation for you
to follow Suzanne since John also follows Suzanne.
getRecommendationsForUser(communityId, userId, action, objectCategory, contextAction, contextObjectId, maxResults)
API Version
33.0
Requires Chatter
Yes
Signature
public static ConnectApi.RecommendationCollection getRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, String objectCategory, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- objectCategory
- Type: String
-
- If action is follow, objectCategory is users, files, or records.
- If action is join, objectCategory is groups.
- If action is view, objectCategory is users, files, groups, records, or custom.
- If action is follow, objectCategory is 005 (users), 069 (files), or 001 (accounts), for example.
- If action is join, objectCategory is 0F9 (groups).
- If action is view, objectCategory is 005 (users), 069 (files), 0F9 (groups), 0RD (custom recommendations), or 001 (accounts), for example.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
Return Value
Usage
If you want to get recommendations based on a recent action performed, such as following a user, use contextAction and contextObjectId together. For example, if you just followed Pam, you specify follow for contextAction and Pam’s user ID for contextObjectId.
This method only recommends users who are followed by people who
follow Pam. In this example, John follows Pam so the method returns a recommendation for you
to follow Suzanne since John also follows Suzanne.
rejectRecommendationForUser(communityId, userId, action, objectId)
API Version
33.0
Requires Chatter
Yes
Signature
public static rejectRecommendationForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, String objectId)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation. Supported values are:
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- objectId
- Type: String
- Specifies the object to take action on.
- If action is follow, objectId is a user ID, file ID, or record ID.
- If action is join, objectId is a group ID.
- If action is view, objectId is a custom recommendation ID.
Return Value
Type: Void
rejectRecommendationForUser(communityId, userId, action, objectEnum)
API Version
34.0
Requires Chatter
Yes
Signature
public static rejectRecommendationForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, ConnectApi.RecommendedObjectType objectEnum)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation. Supported values are:
- view—View a static recommendation.
- objectEnum
- Type: ConnectApi.RecommendedObjectType
- Specifies the object type to take action on.
- Today—Static recommendations that don’t have an ID, for example, the Today app recommendation.
Return Value
Type: Void
Recommendations Test Methods
The following are the test methods for Recommendations. All methods are static.
For information about using these methods to test your ConnectApi code, see Testing ConnectApi Code.
setTestGetRecommendationForUser(communityId, userId, action, objectId, result)
API Version
33.0
Requires Chatter
Yes
Signature
public static Void setTestGetRecommendationForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, String objectId, ConnectApi.RecommendationCollection result)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- objectId
- Type: String
- Specifies the object to take action on.
- If action is follow, objectId is a user ID, file ID, or record ID.
- If action is join, objectId is a group ID.
- If action is view, objectId is a user ID, file ID, group ID, record ID, or custom recommendation ID.
- result
- Type: ConnectApi.RecommendationCollection
- The object containing test data.
Return Value
Type: Void
setTestGetRecommendationsForUser(communityId, userId, contextAction, contextObjectId, maxResults, result)
API Version
33.0
Requires Chatter
Yes
Signature
public static Void setTestGetRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults, ConnectApi.RecommendationCollection result)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
- result
- Type: ConnectApi.RecommendationCollection
- The object containing test data.
Return Value
Type: Void
setTestGetRecommendationsForUser(communityId, userId, action, contextAction, contextObjectId, maxResults, result)
API Version
33.0
Requires Chatter
Yes
Signature
public static Void setTestGetRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults, ConnectApi.RecommendationCollection result)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
- result
- Type: ConnectApi.RecommendationCollection
- The object containing test data.
Return Value
Type: Void
setTestGetRecommendationsForUser(communityId, userId, action, objectCategory, contextAction, contextObjectId, maxResults, result)
API Version
33.0
Requires Chatter
Yes
Signature
public static Void setTestGetRecommendationsForUser(String communityId, String userId, ConnectApi.RecommendationActionType action, String objectCategory, ConnectApi.RecommendationActionType contextAction, String contextObjectId, Integer maxResults, ConnectApi.RecommendationCollection result)
Parameters
- communityId
- Type: String
- Use either the ID for a community, internal, or null.
- userId
- Type: String
- The ID for the context user or the keyword me.
- action
- Type: ConnectApi.RecommendationActionType
- Specifies the action to take on a recommendation.
- follow—Follow a file, record, or user.
- join—Join a group.
- view—View a file, group, record, user, or custom recommendation.
- objectCategory
- Type: String
-
- If action is follow, objectCategory is users, files, or records.
- If action is join, objectCategory is groups.
- If action is view, objectCategory is users, files, groups, records, or custom.
- If action is follow, objectCategory is 005 (users), 069 (files), or 001 (accounts), for example.
- If action is join, objectCategory is 0F9 (groups).
- If action is view, objectCategory is 005 (users), 069 (files), 0F9 (groups), 0RD (custom recommendations), or 001 (accounts), for example.
- contextAction
- Type: ConnectApi.RecommendationActionType
- Action that the context user just performed. Supported values are:
- follow
- view
- contextObjectId
- Type: String
- ID of the object that the context user just perfomed an action on.
- If contextAction is follow, contextObjectId is a user ID, file ID, or record ID.
- If contextAction is view, contextObjectId is a user ID, file ID, group ID, or record ID.
- maxResults
- Type: Integer
- Maximum number of recommendation results; default is 10. Value must be greater than 0.
- result
- Type: ConnectApi.RecommendationCollection
- The object containing test data.
Return Value
Type: Void