#contentsx(depth=1:2); *JSONインタフェース [#t4d29e80] CxB RankPoint Simulatorのデータベースに登録されているデータをJSONで取得できます 公開インタフェースはすべて[[JSONP>https://ja.wikipedia.org/wiki/JSONP]]に対応しています。Content-Typeは以下で返却します :JSON形式での返却 | application/json; charset=utf-8 :JSONP形式での返却 | application/javascript; charset=utf-8 **楽曲情報単曲取得 [#api_music] ***パラメータ [#m9d28f2b] |~項目|~説明|h |~楽曲番号(必須)|コレクションでの連番に準じる番号| |~コールバック関数名(任意)|指定がある場合、コールバック関数でデータをくくってJSONP形式で返却します| ***URI [#taf051b7] :リクエスト先URI | http://cxbrank.maplia.jp/api/music/[楽曲番号]?callback=[コールバック関数名] :サンプルURI | http://cxbrank.maplia.jp/api/music/63 ***レスポンスフィールド [#m1063a8a] フィールドの出現順序は不定です(保証しません) |>|フィールド|キー名|型|説明|h |>|~楽曲番号|number|numeric|コレクションでの連番に準じる番号| |>|~タイトル|title|string|楽曲のタイトル(サブタイトルを除く)| |>|~サブタイトル|subtitle|string|楽曲のサブタイトル(ない場合はnull)| |>|~フルタイトル|full_title|string|楽曲の全体タイトル(タイトル+半角スペース+サブタイトル)| |>|~期間限定フラグ|limited|bool|未配信のイベント先行出現曲の場合に''true''、それ以外はfalse| |>|~月間RP曲フラグ|monthly|bool|リクエスト時点の月間RP曲である場合に''true''、それ以外はfalse| |>|~STANDARD譜面情報|std|(ネスト)|| |~├|~レベル|level|numeric|譜面の設定レベル(float値で返却します)| |~└|~ノート数|notes|numeric|譜面の総ノート数(ノート種類は区別しません)| |>|~HARD譜面情報|hrd|(ネスト)|| |~├|~レベル|level|numeric|同上| |~└|~ノート数|notes|numeric|~| |>|~MASTER譜面情報|mas|(ネスト)|| |~├|~レベル|level|numeric|同上| |~└|~ノート数|notes|numeric|~| |>|BGCOLOR(#aaaaaa):~EASY譜面情報|BGCOLOR(#cccccc):esy|BGCOLOR(#cccccc):(ネスト)|BGCOLOR(#cccccc):| |BGCOLOR(#aaaaaa):~├|BGCOLOR(#aaaaaa):~レベル|BGCOLOR(#cccccc):level|BGCOLOR(#cccccc):numeric|BGCOLOR(#cccccc):null固定| |BGCOLOR(#aaaaaa):~└|BGCOLOR(#aaaaaa):~ノート数|BGCOLOR(#cccccc):notes|BGCOLOR(#cccccc):numeric|BGCOLOR(#cccccc):null固定| |>|BGCOLOR(#aaaaaa):~UNLIMITED譜面情報|BGCOLOR(#cccccc):unl|BGCOLOR(#cccccc):(ネスト)|BGCOLOR(#cccccc):| |BGCOLOR(#aaaaaa):~├|BGCOLOR(#aaaaaa):~レベル|BGCOLOR(#cccccc):level|BGCOLOR(#cccccc):numeric|BGCOLOR(#cccccc):null固定| |BGCOLOR(#aaaaaa):~└|BGCOLOR(#aaaaaa):~ノート数|BGCOLOR(#cccccc):notes|BGCOLOR(#cccccc):numeric|BGCOLOR(#cccccc):null固定| **楽曲情報一括取得 [#api_musics] ***パラメータ [#zea380a4] |~項目|~説明|h |~コールバック関数名(任意)|指定がある場合、コールバック関数でデータをくくってJSONP形式で返却します| ***URI [#ece9fa98] :リクエスト先URL | http://cxbrank.maplia.jp/api/musics?callback=[コールバック関数名] :サンプルURI | http://cxbrank.maplia.jp/api/musics ***レスポンスフィールド [#wd66d97c] 単曲取得と同じ構成のオブジェクトを配列にして、データベースにあるすべての楽曲データを返却します。配列の並びは楽曲番号の昇順です *データ登録インタフェース [#v546c0e1] プレイ成績データをJSON形式でPOST送信することで、Webでのログインを経ずに直接データの編集ができます Content-Typeはapplication/jsonで送信(application/x-www-form-urlencodedにはしない) 1曲単位の更新のみ受け付けます(複数更新する場合はその件数だけリクエストする) **リクエストフィールド [#s0d80019] ここに含まれるキー以外はすべて無視します |>|>|フィールド|キー名|型|説明|h |>|>|~ユーザID|user_id|string|ユーザのID(数字5ケタ)| |>|>|~パスワード|password|string|ユーザのパスワード| |>|>|~楽曲番号|number|numeric|コレクションでの連番に準じる番号| |>|>|~プレイ成績データ|skill|(ネスト)|| |~├|>|~コメント|comment|string|プレイ成績データに関するコメント| |~├&br();│&br();│&br();│&br();│&br();│&br();│&br();│|>|~STANDARD譜面|std|(ネスト)|(※省略可能にする予定: 未プレイ状態にする)| |~|~├|~プレイ状態|stat|numeric|0:未プレイ、1:クリア済み、2:クリア失敗| |~|~├|~RP|point|numeric|譜面のRP(小数点以下2ケタのfloat値)| |~|~├|~クリアレート|rate|numeric|譜面のクリアレート(0~100のint値)| |~|~├|~クリアレート|rank|numeric|0:指定なし、1:S++、2:S+、~、9:D、10:E| |~|~├|~フルコンボ|fcs|numeric|0:指定なし、1:フルコンボ、2:All Flawless(エクセ)| |~|~└|~ロック状態|locked|numeric|0:ロックなし、1:ロック状態(または未所持)| |~├&br();│&br();│&br();│&br();│&br();│&br();│&br();│|>|~HARD譜面|hrd|(ネスト)|| |~|~├|~プレイ状態|stat|numeric|同上| |~|~├|~RP|point|numeric|~| |~|~├|~クリアレート|rate|numeric|~| |~|~├|~クリアレート|rank|numeric|~| |~|~├|~フルコンボ|fcs|numeric|~| |~|~└|~ロック状態|locked|numeric|~| |~├&br();│&br();│&br();│&br();│&br();│&br();│&br();│|>|~MASTER譜面|mas|(ネスト)|| |~|~├|~プレイ状態|stat|numeric|同上| |~|~├|~RP|point|numeric|~| |~|~├|~クリアレート|rate|numeric|~| |~|~├|~クリアレート|rank|numeric|~| |~|~├|~フルコンボ|fcs|numeric|~| |~|~└|~ロック状態|locked|numeric|~| ***URI [#taf051b7] :リクエスト先URI | http://cxbrank.maplia.jp/edit_direct ***レスポンス [#zd95b294] HTTPステータスコードで処理結果を返却します |~成否|>|~ステータス|~説明|h |~成功|~200|OK|更新(または新規作成)成功| |~失敗|~400|Bad Request|送信データ不備(該当曲が存在しない、バリデーションを通らないなど)| |~|~401|Unauthorized|ユーザ認証失敗(パスワード間違いなど)| |~|~405|Method Not Allowed|リクエストがPOSTメソッドでない| |~|~500|Internal Server Error|その他の内部エラー(プログラム側のバグかも)| *js [#k63895a6] (function(jQuery) { // プログレスダイアログ jQuery.progress = function (title) { if (jQuery('body').find('#progress-dialog').length == 0) { jQuery('body').append('<div id="progress-dialog"><table id="progress-table"><tbody><tr><td id="progress-message1"></td></tr><tr><td id="progress-message2"></td></tr><tr><td><div id="progressbar"></div></td></tr></tbody></table></div>'); jQuery('#progress-dialog').dialog({ title: title, autoOpen: false, modal: true, width: 450, height: 260, draggable: false, resizable: false, closeOnEscape: false, buttons: { 'キャンセル': function () { jQuery.progress.cancel(); if (jQuery.progress.cancelCallback) { jQuery.progress.cancelCallback(); } } } }); jQuery('#progress-table').css('width', '100%'); jQuery('#progress-table').css('font-size', '1.1em'); jQuery('#progress-table tr td').css('height', '1.4em'); } return this.extend(jQuery.progress, { open: function (cancelCallback) { this.canceled = false; this.cancelCallback = cancelCallback; jQuery('#progress-type').text(''); jQuery('#progress-title').text(''); jQuery('#progressbar').progressbar({ max: 0, value: false }); jQuery('#progress-dialog').dialog('open'); jQuery('.ui-dialog-titlebar-close').hide(); return this; }, close: function () { jQuery('#progress-dialog').dialog('close'); }, cancel: function () { console.log('canceled!'); this.canceled = true; }, isCanceled: function () { return this.canceled; }, setMessage1: function (message) { jQuery('#progress-message1').text(message); }, setMessage2: function (message) { jQuery('#progress-message2').text(message); }, setProgressbarMax: function (max) { jQuery('#progressbar').progressbar({ max: max, value: 0 }); }, incProgressbarValue: function () { jQuery('#progressbar').progressbar('value', jQuery('#progressbar').progressbar('value') + 1); } }); }; // メッセージ表示ダイアログ jQuery.alert = function (message, title) { var deferred = jQuery.Deferred(); if (jQuery('body').find('#alert-dialog').length == 0) { jQuery('body').append('<div id="alert-dialog"><p id="alert-message"></p></div>'); jQuery('#alert-dialog').dialog({ title: title, autoOpen: false, modal: true, width: 450, height: 250, draggable: false, resizable: false, closeOnEscape: false, buttons: { 'OK': function () { jQuery('#alert-dialog').dialog('close'); deferred.resolve(); } } }); } jQuery('#alert-message').text(message); jQuery('#alert-dialog').dialog('open'); jQuery('.ui-dialog-titlebar-close').hide(); return deferred.promise(); }; // 確認ダイアログ jQuery.confirm = function (message, title, acceptCallback, cancelCallback) { var deferred = jQuery.Deferred(); jQuery.confirm.self = this; jQuery.confirm.self.acceptCallback = acceptCallback; jQuery.confirm.self.cancelCallback = cancelCallback; if (jQuery('body').find('#confirm-dialog').length == 0) { jQuery('body').append('<div id="confirm-dialog"><p id="confirm-message"></p></div>'); jQuery('#confirm-dialog').dialog({ title: title, autoOpen: false, modal: true, width: 450, height: 250, draggable: false, resizable: false, closeOnEscape: false, buttons: { 'はい': function () { jQuery('#confirm-dialog').dialog('close'); jQuery.confirm.self.acceptCallback(); deferred.resolve(); }, 'いいえ': function () { jQuery('#confirm-dialog').dialog('close'); jQuery.confirm.self.cancelCallback(); deferred.reject(); } } }); } jQuery('#confirm-message').text(message); jQuery('#confirm-dialog').dialog('open'); jQuery('.ui-dialog-titlebar-close').hide(); return deferred.promise(); }; })(jQuery);