">mixi Developer Center (mDC)

mixi Connect

mixi Connect (English) » mixi Graph API » Technical Specification » Profile Image API

Profile Image API

The profile image is perhaps the most often seen information about a user. Its presence makes it easy to recognize each friend. With the Profile Image API, it's possible to retrieve a user's or its friends' various profile images, and using the upload functionality it's possible to let the user personalize their profile.

Prerequisites

To use the Profile Image API, you are required to have the following information beforehand.

  • An access token authorized for either or both the “r_profile” and ”w_profile” scopes

You can only access the Profile Image API with an authorized access token as mentioned above. For details on how to obtain an access token, see the page on the "procedures for authorization".

Functions provided by the Profile Image API, and the necessary scope

The various functions provided by the Profile Image API fall into the following two major groups: reading and writing. This classification directly corresponds to the scopes for using the Profile Image API. The following shows the scopes and corresponding functions:

Scope Functions
r_profile Obtaining the profile images
w_profile Creating a profile image
Changing the settings for a profile image
Deleting a profile image

Obtaining a list of the profile images

The following URI is for retrieving a list of the profile images.

GET https://api.mixi-platform.com/2/people/images/[User-ID]/@self/[Image-ID]
Parameter name Value to be specified
User-ID User ID for the approved user or “@me”, or a friend's user ID
Image-ID ID for a profile image. If it is specified, only information on this profile image is returned as a result of an API call. Can be omitted.

In addition, the query parameters below are supported:

Parameter name Description
privacy By setting this parameter, only the images of the specified privacy setting are returned. The allowed values are “everyone” (public images), “friends” (only visible to friends) and “self” (private).
primary By setting this to “true”, only the main profile image will be returned.
startIndexStart index
countMaximum number of results
fields Specify the fields you want information for, separated by a comma. Specifiable field names are: “id”, “thumbnailUrl”, “privacy”, “primary”, “created”, “recommender”. By default, these fields are returned: “id”, “thumbnailUrl”, “privacy”, “primary”. “@all” can also be used to specify all fields. The fields “id” and “thumbnailUrl” will always be included in the result.

On a successful request, the result will be similar to the following. This sample is in JSON format.

{
    "entry" : [
        {
            "id" : "e82686f7306cd840d51d3f548e4ed8fd606062f094",
            "thumbnailUrl" : "http://profile.img.mixi.jp/photo/user/1FGOBIWJSAOCUWBBC_214356712.jpg",
            "privacy" : "friends",
            "primary" : "true",
            "created" : "2011-06-27T16:49:53+09:00",
            "recommender" : {
                    "thumbnailUrl" : "http://mixi/photo/member/p/68/a9/68a751a1793f3e7b1969403572df4f782aa520c29619.jpg",
                    "id" : "zx4r5dmbrd5mx",
                    "displayName" : "Jack",
                    "profileUrl" : "http://mixi.jp/redirect_friend_api.pl?puid=xxxxxxxxxxxxx&client_id=xxxxxxxx",
                    "message" : "Here is the recommended image"
             },
        }...
    ]...

}

Each entry contains the following information:

Field name Description
id ID (Image-ID) to identify the profile image
thumbnailUrl Profile image URL
privacy The profile image's privacy setting. The possible values are “everyone” (visible to all), “friends” (visible to friends) and "self" (private image).
primary true if this is the main profile image, otherwise false.
created The profile image creation date. The format is “yyyy-mm-ddThh:mm:ss+09:00” (for more information see XSdateTime).
recommender A hash with information about the user who recommended this profile image. The included fields are “id” (the user's ID), “displayName” (nickname), “thumbnailUrl” (profile image URL), “profileUrl” (profile page URL) and “message” (recommendation message). If this user isn't a friend of the request's approved user, only “id”, “displayName” and “thumbnailUrl” are included.

Creating a profile image

The following URI is for creating a profile image.

 POST https://api.mixi-platform.com/2/people/images/[User-ID]/@self 
Parameter name Value to be specified
User-ID User ID for the approved user or “@me”

In addition, the query parameters below are supported:

Parameter name Description
privacy The initial value of the privacy setting. The allowed values are “everyone” (public images) and “friends” (only visible to friends). This parameter is required.

The Content-Type request header should be set to “image/jpeg”, and the request body should contain the image's binary data. See below for an example request.

POST https://api.mixi-platform.com/2/people/images/@me/@self?privacy=everyone HTTP/1.1
Host: api.mixi-platform.com
Content-Type: image/jpeg
Content-Length: 123456

d84ba376eaaa786249...

Upon success, the response has a status code of 201 and the new profile image's ID is returned in JSON format as follows.

{
    "id" : "73a1354313a8dced1ca07a68c1204b3d727042d048"
}

Changing the settings for a profile image

The following URI is for changing the settings of an existing profile image.

PUT https://api.mixi-platform.com/2/people/images/[User-ID]/@self/[Image-ID]
Parameter name Value to be specified
User-ID User ID for the approved user or “@me”
Image-ID The profile image's ID. Required.

In the request body, the new settings for the profile image are included in application/json format.

{
    "privacy" : "everyone",
    "primary"  : true
}

The value to be specified for each field is shown below.

Parameter name Value to be specified
privacy The profile image's privacy setting. The allowed values are “everyone” (public images) and “friends” (only visible to friends).
primary When set to true, the profile image designated by the Image-ID will become the main profile image.

Upon success, the response has a status code of 200 and the changed profile image's ID is returned in JSON format as follows.

{
    "id" : "73a1312d23a8dced1ca07a68c1204b3d727042d044",
}

Deleting a profile image

The following URI is for deleting a profile image.

DELETE https://api.mixi-platform.com/2/people/images/[User-ID]/@self/[Image-ID]
Parameter name Value to be specified
User-ID User ID for the approved user or “@me”
Image-ID The profile image's ID. Required.

Upon success, the response has a status code of 200.

TOP OF THIS PAGE