">mixi Developer Center (mDC)

mixi Connect

mixi Connect (English) » mixi Graph API » Technical Specification » Diary API

Diary API

mixiDiary is currently one of the essential services provided by mixi. Many mixi users keep diary entries. The Diary API will allow users to easily post these entries with various disclosure ranges including "not disclosed" and "disclosed to friends." These diaries can include photos as well.

This section outlines how to use the Diary API.

What you need

The following information must be obtained before using the Diary API.

  • Access token approved for "w_diary" or "r_diary" scope

Any other access tokens approved for other scopes cannot be used to access the Diary API. See the authorization approval process page to acquire access tokens.

Post diary entry

The following URL is for posting diary entries.

POST https://api.mixi-platform.com/2/diary/articles/@me/@self

Specify a diary entry, which you wish to post as a request body, as follows in multipart/form-data format.

*Diaries with no photo can be posted in application/JSON format. (Details discussed later)

boundary character string
Content-Disposition: form-data; name="request"

{
    "title":"Title of diary entry",
    "body":"Body of diary entry",
    "privacy":{
        "visibility":"group",
        "group":"10",
        "show_users":"0"
    }
}
boundary character string
Content-Disposition: form-data; name="photo1"; filename="image to attach1.jpg"
Content-Type: image/jpeg

.......binary data of image to attach
boundary character string
Content-Disposition: form-data; name="photo2"; filename="image to attach2.jpg"
Content-Type: image/jpeg

.......binary data of image to attach
boundary character string
Content-Disposition: form-data; name="photo3"; filename="image to attach3.jpg"
Content-Type: image/jpeg

.......binary data of image to attach

The following are the values to be specified for each item.

Parameter name Description Required
title Title character string of diary
body Body of diary
privacy Disclosure range setting of this diary *(Details discussed later)
  • Specify name="request"for diary information and photo1, photo2, photo3 for the first, second, and third image in the appropriate fields, which are separated by the boundary character strings. Up to three images can be added.
  • JPEG is used for the image format.

Post the diary entry with no image

Define your diary entry in application/JSON format as follows.

{
    "title":"Title of diary entry",
    "body":"Body of diary entry",
    "privacy":{
             "visibility":"group",
             "group":"10",
             "show_users":"0"
      }
}

Format of "privacy" parameter

The disclosure range for the diary can be defined in the privacy parameter.
This privacy parameter consists of three parameters: visibility, group, and show_users.

While the visibility parameter defines the type of disclosure range,
group parameter and show_users define the authorized group's ID and whether to show the names of authorized users respectively for the diary disclosure.
Group parameter is required only when ”group” is selected in the visibility setting.

See below for the details of these parameter settings.

Specified value Meaning
everyone Disclose to everyone
friends Disclose to friends
friends_of_friends Disclose to friends of friends
top_friends Disclose to good friends
group Disclose to specific groups
self Not disclosed
Format of group parameter value

When the "share with a specific group only" is selected, then the group parameter needs to be populated within privacy.

"privacy":{
        "visibility":"group",
        "group":"5"
}

For the "group" value, define a group ID you want to disclose.
*In this group ID, use the ID acquired from the Groups API.

show_users parameter value

By defining show_users,
the disclosure range can be set either "Do not disclose" or "Disclose to friends".

Define 0 to select "Do not disclose".
Define 1 to select "Disclose to friends".
Not defining the value will set it to "Do not disclose"

See the following URL for more details about this setting specification.
http://mixi.jp/help.pl?mode=item&item=567

Insert a mixi photo into the body of a diary

Any mixi photos uploaded via the Photo API can be inserted into the character string of the body parameter: the body of diary.
If such is the case, insert the following character string into the body parameter.

<photo src="v2:「MediaItem ID of the photo information acquired with Photo API」">

Lager size of photos can be inserted by adding ”:l” after the "”MediaItem ID” as follows.

<photo src="v2:「MediaItem ID of the photo information acquired with Photo API」:l">

Response specifications

When the process is successful, the API returns the following character string in JSON format.

{
    "id":"1656400812"
}
Item Description
id ID for newly created diary

Code 201 is returned for HTTP status code.

When the posting process fails, the following JSON character strings are returned indicating the error with a status code of 400s or 500s.

{
    "error" : "access_denied",
    "error_description" : "your account is temporary prohibited"
}

Format

The character code to be used for a request is UTF-8. UTF-8 must be specified for the charset value in the Content-Type request header.

This API supports pictogram conversion.
See the following pages for the details of pictogram specifications.
How pictogram is processed

TOP OF THIS PAGE