IN.API.MemberUpdates() and IN.API.NetworkUpdates()
There are two different contexts to retrieve network streams - for the current member, or for their network. These are very similar, and are described below.
MemberUpdates
IN.API.MemberUpdates(id).fields(fields).result(resultCallback) IN.API.MemberUpdates().ids(id).fields(field1, field2, field3).result(resultCallback) IN.API.MemberUpdates().ids(id).fields([field1, field2]).result(resultCallback)
- default ids() - {String}
Specifies the ID to retrieve - fields() (optional) - Array {String}, Argument List {String}
Specifies the fields to retrieve. If not specified, the default fields will be the server supplied defaults, subject to change. See Get Network Updates and Statistics API for information about the returned fields. - params() (optional) Object with parameters to pass to the backend call. See Get Network Updates and Statistics APIGet Network Updates and Statistics API for information about supported parameters.
Examples:
IN.API.MemberUpdates("me")
.result(doMyThing)
This basic call will get the full stream for the member, with all types of status updates included. Note that in this case, the code processing the results will need to be very careful about making assumptions about data structure - each network update type has slightly different information.
{ "isCommentable": true, "timestamp": 1300835525778, "updateContent": { "person": { "headline": "Developer Advocate at LinkedIn", "id": "G0uYndFs07", "lastName": "Jones", "pictureUrl": "http://media.linkedin.com/mpr/mprx/0_8LXTPUg_-zq6MqhxhCFtP4mpKv_nUBhxGbrOPJYy7KBQk1c02iqSjMotYRiW4K3PT66xyY8wEb9q", "siteStandardProfileRequest": { "url": "http://www.linkedin.com/profile?viewProfile=&key=3639896&authToken=JdAa&authType=name&trk=api*a124520*s132954*" }, "apiStandardProfileRequest": { "headers": { "values": [{ "name": "x-li-auth-token", "value": "name:JdAa" }], "_total": 1 }, "url": "http://api.linkedin.com/v1/people/G0uYndFs07" }, "firstName": "Kirsten" } }, "numLikes": 0, "isLiked": false, "updateKey": "PROF-3639896-5456099657539125248-*1", "updateType": "PROF", "updatedFields": { "values": [{ "name": "person/specialties" }], "_count": 1 }, "isLikable": true }
Restricting Fields
When making calls for network updates, a lot of information is returned by default. You can restrict the fields you get back so that you only get the information you want. For a list of fields for network types you can see the Get Network Updates and Statistics API
document. If want to understand what fields are available for each person, see the Profile Fields documentation, as well as the Field Selector information to understand how to express your request correctly.
In this example, we're just finding out whether the member "liked" the update and the person's headline and first name.
IN.API.MemberUpdates("me")
.fields(["isLiked","updateContent:(person:(headline,first-name))"])
.result(domything)
This request will return a much tidier set of network updates, with only minimal information.
{"updateContent":{ "person":{
"headline":"Developer Advocate at LinkedIn",
"firstName":"Kirsten"
}
},
"isLiked":false
}
Restricting Update Types
One of the ways to make the stream manageable is to restrict it to one or more Network Update Types.
IN.API.MemberUpdates("me")
.params({"type":"STAT"})
.result(function(result) {
alert JSON.stringify(result))
}
IN.API.MemberUpdates("me")
.params({"type":["STAT","CMPY"], count=5})
.result(function(result) {
alert JSON.stringify(result))
}
IN.API.NetworkUpdates()
The format, parameters, and fields for NetworkUpdates are identical to the MemberUpdates call. The results are for the network, not the user - and the results do not include the user's updates.
Documentation
- Tutorials
- Javascript API Reference
- Overview
- Configuration and Compatibility
- IN.API.Profile()
- Making API Requests using IN.API
- IN.API.Connections()
- IN.API.PeopleSearch()
- IN.API.MemberUpdates() and IN.API.NetworkUpdates()
- IN.API.Raw()
- Tags and Templates
- IN.Auth, IN.Event, and IN.UI
- General Methods
- Exchange JSAPI Tokens for REST API OAuth Tokens
- Plugins
- Publisher Guidelines