Hatena::Grouphatenadeveloper

Hatena Haiku RESTful APIs

en/haiku/apis/rest

Hatena Haiku RESTful APIs

Introduction

Hatena Haiku RESTful APIs enable your application to create (post / associate), retrieve, or delete entries, keywords, favorites, stars, and so on, from Hatena Haiku, on behalf of your users. This document describes how to use these API.

Notice on this document

We may discontinue or change Hatena Haiku APIs, or its availability to you at any time.

Hatena reserves the right to limit, close, or remove, either temporarily or indefinitely, any user's account when the user exeeds the ordinary use of the service. Applications MUST send their own name in the HTTP User-Agent: header field.

Versions

Sometimes in this document we refer to Version 1.1 of Hatena Haiku. Version 1.1 of the service is available at the formal domain (i.e. h.hatena.com and h.hatena.ne.jp) from Feburary 14, 2011, as well as at the beta-testing domain (i.e. h1beta.hatena.com and h1beta.hatena.ne.jp).

Authentication

Accessing without authentication

Most of read-only APIs can be used without authentication.

OAuth

New in Version 1.1

The APIs support OAuth-based user authentication. You can obtain Consumer Keys for the OAuth access from the Access Hatena services with OAuth section in your User Settings. There is a tutorial document はてなサービスにおける OAuth (available only in Japanese at the time of writing, but sample codes are also included there).

For read operations, the scope read_public is required; for write/delete operations, the scope write_public is required.

Basic authentification

Deprecated

HTTP Basic Authentication is supported by Hatena Haiku but is now DEPRECATED in favor of OAuth.

Please input "Hatena ID" for ID, and "API password" for password (...@h.hatena.com).

ATTENTION: Hatena Haiku API use not Hatena password but "API password" for password.

Available Data Formats

Hatena Haiku APIs presently supports the following data formats: JSON, JSONP, XML. You can get it by specifying .json, .json?callback=cb, .xml respectively. See detailed documentation and examples for APIs.

Timeline APIs

A timeline is a list of zero or more entries. Following APIs provide access to various kind of timelines:

NameCorresponding page in the Web site
statuses/public_timelineHatena Haiku Top page
statuses/keyword_timelineEntries page for a keyword
statuses/user_timelineEntries page for a user
statuses/friends_timelineAntenna page for a user
statuses/albumAlbum page for a keyword or the entire service

Entry and Star APIs

Following APIs can be used to post, retrieve, or delete entries and stars:

NameOperation
statuses/updatePost a new entry
statuses/showRetrieve an entry
statuses/destroyDelete an entry
favorites/createAdd a star to the entry
favorites/destroyDelete a star from the entry

User and keyword APIs

Following APIs can be used to retrieve or operates on users and keywords:

NameOperation
friendships/showRetrieve user's data
keywords/showRetrieve keyword's data
keywords/hotRetrieve list of hot keywords
keywords/listSearch for keywords
keywords/relation/createMark two keywords as related
keywords/relation/destroyUnmark two related keywords

Favorite APIs

Following APIs can be used to retrieve list of favorite users and keywords, and to add or remove favorite users and keywords:

NameOperations
statuses/friendsRetrieve the list of favorite users of a user
statuses/followersRetrieve the list of fan (or favorited) users of a user
friendships/createAdd a user to the favorites
friendships/destroyRemove a user from the favorites
statuses/keywordsRetrieve the list of favorite keywords of a user
keywords/createAdd a keyword to the favorites
keywords/destroyRemove a keyword from the favorites

Compatibility with Twitter API

Twitter-compatible API

Hatena Haiku RESTful APIs are partially compatible with Twitter APIs. Following features are also available in Twitter APIs:

Extended APIs for Hatena Haiku

Following APIs are extended for Hatena Haiku specific features such as keywords:

History

  • December 13, 2010 Republished at Hatena Developer Center.
  • December 24, 2010 Added new features in Version 1.1 Beta.
  • February 14, 2011 Added new features in Version 1.1.