">mixi Developer Center (mDC)

mixi Apps

mixi Apps (English) » Technical Specification » PC » Community Information

Community Information

“Community” is popular among users and the users join certain communities where they can communicate with other users on common topics. In other words, the information of the communities a user participates in, in particular, is very valuable to learn the user’s interests.

In the mixi App specification, the developer is allowed to obtain the information in whichcommunities a certain user participate.

List of Communities

The mixi.newFetchCommunityRequest() is available to acquire a list of communities a user belongs to. The following code shows an example of retrieving thelist of the communities by the newFetchCommunityRequest().

var req = opensocial.newDataRequest();
req.add(mixi.newFetchCommunityRequest(opensocial.IdSpec.PersonId.VIEWER), "communities");
req.send(function(data) {
  var communities = data.get("communities").getData();
  communities.each(function(community) {
    var id = community.getId();
    var name = community.getName();
    var thumbnail = community.getField(mixi.Community.Field.THUMBNAIL_URL);
    // do something...
  });
});

Available Parameters

To identify a user one of the following parameters can be specified:

  • opensocial.IdSpec.PersonId.VIEWER
  • opensocial.IdSpec.PersonId.OWNER
  • Specific User ID

The list of the communities can be retrieved from the argument passed to the callback function. The list is stored in the opensocial.Collection object and information for each community can be obtained by using the each().

The following information for each community is available: Community ID, Community Name and URL of the image file of community.

Community ID

Following two functions are available for obtaining the Community ID and results from both of them are same:

  • community.getId()
  • community.getField(mixi.Community.Field.ID)

Community Names

Following two functions are available for obtaining the Community Names and results from both of them are same:

  • community.getName()
  • community.getField(mixi.Community.Field.TITLE)

URL of the Image file of Community

Use mixi.Community.Field.THUMBNAIL_URL is available to obtain the URL of the image file of the community.

  • community.getField(mixi.Community.Field.THUMBNAIL_URL);

Error Codes

In calling Community API, some error codes may be availables. By getErrorCode() in ResponseItem object, the developer is able to obtain these error codes. Analyzing these codes, the developer can determine what causes these errors and how to handle them.

Error Code Reference
400 (BAD_REQUEST) No authentication, or no target ID is specified
403 (FORBIDDEN) No Authorization or a selector including @self or @friends is not specified
500 (INTERNAL_SERVER_ERROR) mixi internal error

TOP OF THIS PAGE