Back to top

ケーススタディ HAL大阪 API一覧

BOCCO x 学習ドリル

ユーザー登録

ユーザー情報の登録、およびサインインするためのAPI

サインアップ
POST/signup

ユーザー情報の登録を行います。

Example URI

POST /signup
Request
HideShow
Headers
Content-Type: applicaition/json
Body
{
  "name": "sample",
  "pass": "password"
}
Schema
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "pass": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "ユーザー登録を行いました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "登録済みのユーザー名です。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

サインイン

サインイン
POST/signin

登録されているユーザー情報を元にサインインを行います。

Example URI

POST /signin
Request
HideShow
Headers
Content-Type: applicaition/json
Body
{
  "name": "sample",
  "pass": "password"
}
Schema
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "pass": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "token": "sample"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "token": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

ユーザー削除

ユーザー削除
DELETE/user

登録されているユーザー情報を削除します。

Example URI

DELETE /user
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "ユーザー情報を削除しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

子供情報設定

子供情報追加
POST/child/

子供の誕生日と性別、ニックネームを設定します。

Example URI

POST /child/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "nickname": "sample",
  "birthday": "2000-01-01",
  "sex": 0
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "nickname": {
      "type": "string"
    },
    "birthday": {
      "type": "string"
    },
    "sex": {
      "type": "number",
      "description": "0:男、1:女"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "child_id": 1
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "child_id": {
      "type": "number"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

子供情報取得
GET/child/

子供ID,誕生日,ニックネーム,性別の一覧を取得します。

Example URI

GET /child/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "children": [
    {
      "child_id": 1,
      "birthday": "2016-10-01T09:00:00+09:00",
      "nickname": "sample",
      "sex": 0
    },
    {
      "child_id": 2,
      "birthday": "2017-03-19T09:00:00+09:00",
      "nickname": "index",
      "sex": 1
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "children": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

子供情報削除
DELETE/child/{child_id}

登録されている子どもIDの情報を削除します。

Example URI

DELETE /child/1
URI Parameters
HideShow
child_id
string (required) Example: 1
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "削除しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

デバイス

デバイスID発行
POST/device/

新規登録するデバイスIDの発行を行います。

Example URI

POST /device/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "child_id": 1
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "child_id": {
      "type": "number"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "pin": "0000"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "pin": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

デバイス一覧取得
GET/device/

現在登録されているデバイスIDの一覧を取得します。

Example URI

GET /device/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "devices": [
    {
      "child_id": 1,
      "nickname": "sample",
      "child_devices": [
        "sample",
        "index"
      ]
    },
    {
      "child_id": 2,
      "nickname": "test",
      "child_devices": [
        "test",
        "buf"
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "devices": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

デバイスID削除
DELETE/device/{device_id}

登録されているデバイスIDを削除します。

Example URI

DELETE /device/sample
URI Parameters
HideShow
device_id
string (required) Example: sample
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "ボタンIDを削除しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

BOCCOAPI

BOCCOAPI設定
POST/bocco

BOCCOAPIに登録したメールアドレスと、パスワードの入力

Example URI

POST /bocco
Request
HideShow
Headers
Authorization: token
Body
{
  "email": "sample@gmail.com",
  "pass": "abc123"
}
Schema
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "pass": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "メールアドレスとパスワードを登録しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

BOCCOAPI設定の取得
GET/bocco

BOCCOAPIに登録したメールアドレスの取得

Example URI

GET /bocco
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "sample@gmail.com"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

BOCCOAPI削除
DELETE/bocco

BOCCOAPIに登録したメールアドレスと、パスワードの削除

Example URI

DELETE /bocco
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "メールアドレスとパスワードを削除しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

グラフ用のデータ取得

グラフ用の解答データの取得
GET/work/record/{child_id}{?filter}

指定された子どもの記録情報を取得

Example URI

GET /work/record/1?filter=date
URI Parameters
HideShow
child_id
string (required) Example: 1
filter
string (required) Example: date

もしくはgenre

Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "records": [
    {
      "num_probs": "50",
      "genre": "算数",
      "num_ans": 10,
      "num_corr": 5
    },
    {
      "num_probs": "30",
      "genre": "社会",
      "num_ans": 8,
      "num_corr": 8
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "records": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "回答情報が見つかりませんでした。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

詳細データの取得

詳細な解答データの取得
GET/work/record/detail/{child_id}{?date,genre}

指定された子どもの記録情報を取得

Example URI

GET /work/record/detail/1?date=2018-07-04&genre=1
URI Parameters
HideShow
child_id
string (required) Example: 1
date
string (required) Example: 2018-07-04
genre
string (required) Example: 1

genre_id

Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "records": [
    {
      "date": "2018-06-21T13:35:08+09:00",
      "genre_name": "算数",
      "detail": [
        {
          "sentence": "1 + 1は?",
          "user_ans": "2",
          "correct": "2",
          "result": true
        },
        {
          "sentence": "3",
          "user_ans": "2",
          "correct": "1",
          "result": false
        }
      ]
    },
    {
      "date": "2018-06-22T13:35:08+09:00",
      "genre_name": "社会",
      "detail": [
        {
          "sentence": "兵庫県の県庁所在地は?",
          "user_answer": "兵庫市",
          "correct": "神戸市",
          "result": false
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "records": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "回答情報が見つかりませんでした。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

メッセージ

メッセージ登録
POST/work/message/

オリジナルメッセージの登録を行います。

Example URI

POST /work/message/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "child_id": 1,
  "message_call": 3,
  "condition": 10,
  "message": "practice"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "child_id": {
      "type": "number"
    },
    "message_call": {
      "type": "number",
      "description": "(1: 正解,2:不正解,3: 連続正解時)"
    },
    "condition": {
      "type": "number",
      "description": "3の時"
    },
    "message": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "メッセージを編集しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

メッセージ取得
GET/work/message/

登録されているメッセージとメッセージ出力条件を取得します。

Example URI

GET /work/message/
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "messages": [
    {
      "child_id": 1,
      "nickname": "sample",
      "child_messages": [
        {
          "message_call": 2,
          "message": "practice"
        },
        {
          "message_call": 3,
          "condtion": 5,
          "message": "sample"
        }
      ]
    },
    {
      "child_id": 2,
      "nickname": "index",
      "child_messages": [
        {
          "message_call": 3,
          "condition": 10,
          "message": "sample"
        },
        {
          "message_call": 1,
          "message": "hoge"
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "messages": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

メッセージ削除

メッセージ削除
DELETE/work/message/{message_id}

オリジナルメッセージの削除を行います。

Example URI

DELETE /work/message/sample
URI Parameters
HideShow
message_id
string (required) Example: sample
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": "メッセージを削除しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "ログインエラー"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

ICリーダーAPI

デバイス

デバイス登録
POST/thing/registration

デバイスIDと各デバイスとの紐付けを行います。

Example URI

POST /thing/registration
Request
HideShow
Headers
Content-Type: applicaition/json
Body
{
  "pin": "0000"
}
Schema
{
  "type": "object",
  "properties": {
    "pin": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "device_id": "sample"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "device_id": {
      "type": "string"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "pinが見つかりません。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

ICリーダー

回答データを送信
POST/thing/reader

デバイス情報と読み取ったタグの情報を送信。

Example URI

POST /thing/reader
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "device_id": "sample",
  "uuid": "1234",
  "old_uuid": "5678"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "device_id": {
      "type": "string"
    },
    "uuid": {
      "type": "string"
    },
    "old_uuid": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": 0
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "number",
      "description": "(-1:device_id未登録,-2:old_uuid見つからない,-3:uuid見つからない)"
    }
  }
}

問題作成API

問題作成

問題データの作成
POST/question/create

問題データをDBに登録

Example URI

POST /question/create
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "book_id": 1,
  "question_no": 1,
  "sentence": [
    {
      "tag_id": "sample",
      "text": "回文はどれ?"
    }
  ],
  "answer": [
    {
      "tag_id": "index",
      "text": "絵本"
    },
    {
      "tag_id": "buf",
      "text": "新聞紙"
    },
    {
      "tag_id": "hoge",
      "text": "漫画"
    }
  ],
  "correct": "buf",
  "genre": "1"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "book_id": {
      "type": "number"
    },
    "question_no": {
      "type": "number"
    },
    "sentence": {
      "type": "array"
    },
    "answer": {
      "type": "array"
    },
    "correct": {
      "type": "string"
    },
    "genre": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "登録に失敗しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

分野

分野追加
POST/question/genre

問題分野を追加

Example URI

POST /question/genre
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "genre_name": "英語"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "genre_name": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "genre_id": 1
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "genre_id": {
      "type": "number"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "登録に失敗しました。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

分野取得
GET/question/genre

登録されている分野を取得

Example URI

GET /question/genre
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "genre": [
    "算数",
    "社会",
    "英語"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "genre": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "分野が登録されていませんでした。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

Generated by aglio on 26 Jul 2018