nowa ナニシテルAPI仕様
ナニシテルAPI仕様
概容
JSONまたはXML形式でナニシテルの閲覧・更新・削除等ができます。twitter互換です。使用方法
認証はBASIC認証です。nowa管理画面ホームから、設定>アカウント>API設定画面でAPI Passを作成し、一部のAPI以外はここで作成したPassで認証が必要です。IDはnowa_idを指定してください。nowa APIのURLは、httpでも使用できますが、認証が必要なAPIはhttps経由でアクセスする事を推奨します。返り値形式: XML or JSONの2通りです。APIに拡張子をつけると指定可能です。デフォルトはJSONです。また、JSONのURLにcallback引数を付けることでJSONPとしても利用可能です。
例.
https://api.nowa.jp/status_message/public_timeline => JSON形式 https://api.nowa.jp/status_message/public_timeline.json => JSON形式 https://api.nowa.jp/status_message/public_timeline?callback=cb_func_name => JSON形式 https://api.nowa.jp/status_message/public_timeline.json?callback=cb_func_name => JSON形式 https://api.nowa.jp/status_message/public_timeline.xml => XML形式
エラーの場合
XML:<?xml version="1.0" encoding="UTF-8"?> <hash> <result>fail</result> <error>statusを入力してください。</error> </hash>
JSON:
{"error":"statusを入力してください。","result":"fail"}
- errorは基本的にこの形を取ります。error内にエラーメッセージ、resultはfailのみ。
- 凡例
- xxxx
- DB上のユーザーID。数字。
- yyyy
- ナニシテル等のID。数字
- nowa_id
- nowa id
- xxxx
更新履歴
- 08/02/07
- status_messageのaliasとしてstatusesを追加
- JSONPに対応
- 一部APIの認証を解除
ナニシテル関連
参加者全員のナニシテル最新一覧を表示 / public_timeline
http://api.nowa.jp/status_message/public_timeline.json http://api.nowa.jp/statuses/public_timeline.json
- GET
- 引数
- page ページ番号
- 200 OK
- PortalTOPの新着ナニシテルと同じ。新着20件を返す。
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status> </statuses>
自分または他ユーザーのフレンドのナニシテル一覧を表示 / friends_timeline
https://api.nowa.jp/status_message/friends_timeline.json [Basic Auth] http://api.nowa.jp/status_message/friends_timeline/xxxx.json http://api.nowa.jp/status_message/friends_timeline/nowa_id.json https://api.nowa.jp/statuses/friends_timeline.json [Basic Auth] http://api.nowa.jp/statuses/friends_timeline/xxxx.json http://api.nowa.jp/statuses/friends_timeline/nowa_id.json
- GET
- 引数なし
- 200 OK
- 自分または指定ユーザーがfollowしている(フレンド/お気に入り)ユーザーの新着ナニシテルを20件取得。
- ユーザー未指定かつBASIC認証通過後の場合自分のものを表示。
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status> </statuses>
任意のユーザーのナニシテル一覧を表示 / user_timeline
https://api.nowa.jp/status_message/user_timeline.json [Basic Auth] http://api.nowa.jp/status_message/user_timeline/xxxx.json http://api.nowa.jp/status_message/user_timeline/nowa_id.json https://api.nowa.jp/statuses/user_timeline.json [Basic Auth] http://api.nowa.jp/statuses/user_timeline/xxxx.json http://api.nowa.jp/statuses/user_timeline/nowa_id.json
- GET
- 引数
- page ページ番号
- 200 OK
- 自分/他人のナニシテル発言最新20件
<?xml version="1.0" encoding="UTF-8"?> <statuses type="array"> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status> </statuses>
特定のナニシテル詳細を表示 / show
http://api.nowa.jp/status_message/show/xxxx_yyyyy.json http://api.nowa.jp/status_message/show.json?id=xxxx_yyyyy http://api.nowa.jp/statuses/show/xxxx_yyyyy.json http://api.nowa.jp/statuses/show.json?id=xxxx_yyyyy
- GET
- 引数はナニシテルID
- 200 OK / 404 Not Found
- 特定のナニシテル発言1つのみを取得。他ユーザーのものも取得可。IDはuserID_messageIDの形式になっている。
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status>
特定のナニシテルを削除 / destroy
https://api.nowa.jp/status_message/destroy/xxxx_yyyyy.json [Basic Auth] https://api.nowa.jp/status_message/destroy.json?id=xxxx_yyyyy [Basic Auth] https://api.nowa.jp/statuses/destroy/xxxx_yyyyy.json [Basic Auth] https://api.nowa.jp/statuses/destroy.json?id=xxxx_yyyyy [Basic Auth]
- GET
- 引数はshowと同じ。
- 200 OK / 404 Not Found / 403 Forbidden (他人のを削除しようとした場合)
- ナニシテルの削除。自発言のみ可能。
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status>
- 成功時、削除されたナニシテルがshowの時と同じ形式で返る。
ナニシテルを発言 / update
https://api.nowa.jp/status_message/update.json [Basic Auth] https://api.nowa.jp/statuses/update.json [Basic Auth]
- POST
- 引数 parent_id : show等で指定するIDと同じ形式。指定するとそのナニシテルの返信として発言される。
- 引数 status : 本文。最大255byte。UTF-8。絵文字は{EMOJI:xxxx}形式で。
- 200 OK / 400 Bad Request (GETで投げたとき/validationエラー時)
- ナニシテルの発言を行う。POSTのみ。
<?xml version="1.0" encoding="UTF-8"?> <status> <created_at>2007-12-10 12:00:27</created_at> <id>xxxx_yyyyy</id> <text>ナニシテル本文</text> <source>nowa</source> <truncated>false</truncated> <user> <id>xxxx</id> <name>user name</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <location/> <description/> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <protected>false</protected> </user> </status>
ユーザー情報関連
ユーザー情報を取得 / show
http://api.nowa.jp/user/show.json http://api.nowa.jp/user/show/xxxxx.json http://api.nowa.jp/user/show/nowa_id.json http://api.nowa.jp/user/show.json?id=xxxxxx http://api.nowa.jp/user/show.json?id=nowa_id
- GET
- 引数なし
- 200 OK / 404 Not Found
- ユーザー情報を取得する。返値中のアイコンURLは36x36サイズ。Twitterの48x48はnowaでは未生成。IDはnowa_idと数字のIDどちらでもOK。
<?xml version="1.0" encoding="UTF-8"?> <user> <id>xxxx</id> <name>nickname</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <profile_url>http://xxxx.nowa-dev.jp/profile/ (user Profile URL)</profile_url> <online_status>online / offline</online_status> <friends_count>friends count</friends_count> <status> <text>最新のナニシテル発言</text> </status> </user>
フレンド一覧を表示 / friends
http://api.nowa.jp/user/friends.json http://api.nowa.jp/user/friends/xxxxx.json http://api.nowa.jp/user/friends/nowa_id.json http://api.nowa.jp/user/friends.json?id=nowa_id http://api.nowa.jp/user/friends.json?id=xxxxx
- GET
- 引数なし
- 200 OK / 404 Not Found
- フレンド一覧を取得する。ID未指定で自分、指定すると他人のフレンド一覧の取得。返値はshowで得られるものの配列。
<?xml version="1.0" encoding="UTF-8"?> <users type="array"> <user> <id>xxxx</id> <name>nickname</name> <nowa_id>nowa_id</nowa_id> <screen_name>nowa_id</screen_name> <profile_image_url>user icon url (36x36px)</profile_image_url> <url>http://xxxx.nowa.jp/ (user blog URL)</url> <profile_url>http://xxxx.nowa-dev.jp/profile/ (user Profile URL)</profile_url> <online_status>online / offline</online_status> <friends_count>friends count</friends_count> <status> <text>最新のナニシテル発言</text> </status> </user> </users>
2008年02月07日(木) 20:10:43 Modified by nowa_staff