Back to top

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

BOCCO × 目標ボタンAPI

ユーザー登録

ユーザー情報の登録、およびサインインするための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": "1:男、2:女"
    }
  }
}
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
{
  "goal_id": "sample"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goal_id": {
      "type": "string"
    }
  }
}
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"
    }
  }
}

目標

目標登録
POST/goal/

目標の新規追加を行います。

Example URI

POST /goal/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "child_id": 1,
  "content": "practice",
  "criteria": 20,
  "deadline": "2018-07-01"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "child_id": {
      "type": "number"
    },
    "content": {
      "type": "string"
    },
    "criteria": {
      "type": "number",
      "description": "達成目標数"
    },
    "deadline": {
      "type": "string",
      "description": "達成期日(なければ空)"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "goal_id": "sample"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goal_id": {
      "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"
    }
  }
}

ボタン登録
PUT/goal/

使用するdevice_idを登録します

Example URI

PUT /goal/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "goal_id": "sample",
  "device_id": "sample"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goal_id": {
      "type": "string"
    },
    "device_id": {
      "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/goal/

登録されている目標と実行回数を取得します。

Example URI

GET /goal/
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "goals": [
    {
      "child_id": 1,
      "nickname": "nicname",
      "child_goals": [
        {
          "created_at": "2018-06-21T13:35:08+09:00",
          "goal_id": "test",
          "device_id": "sample",
          "run": 5,
          "content": "practice",
          "criteria": 20,
          "deadline": "2018-07-11T13:35:08+09:00",
          "status": 0,
          "updated_at": "2018-06-21T13:37:21+09:00"
        },
        {
          "created_at": "2018-06-21T13:35:08+09:00",
          "goal_id": "sample",
          "device_id": "hoge",
          "run": 5,
          "content": "index",
          "criteria": 30,
          "deadline": "なし",
          "status": 0,
          "updated_at": "2018-06-21T13:37:21+09:00"
        }
      ]
    },
    {
      "child_id": 2,
      "nickname": "sample",
      "child_goals": [
        {
          "created_at": "2018-06-21T13:35:08+09:00",
          "goal_id": "index",
          "device_id": "index",
          "run": 5,
          "content": "practice",
          "criteria": 20,
          "deadline": "2018-07-11T13:35:08+09:00",
          "status": 0,
          "updated_at": "2018-06-21T13:37:21+09:00"
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goals": {
      "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/goal/{goal_id}

登録されている目標を削除します。

Example URI

DELETE /goal/sample
URI Parameters
HideShow
goal_id
string (required) Example: sample
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"
    }
  }
}

目標達成承認/非承認

達成数変更
PUT/approval

目標実行数を変更します。

Example URI

PUT /approval
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "goal_id": "sample",
  "approval": 1
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goal_id": {
      "type": "string"
    },
    "approval": {
      "type": "number",
      "description": "増減値"
    }
  }
}
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/message/

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

Example URI

POST /message/
Request
HideShow
Headers
Content-Type: application/json
Authorization: token
Body
{
  "goal_id": "sample",
  "message_call": 5,
  "message": "practice"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "goal_id": {
      "type": "string"
    },
    "message_call": {
      "type": "number",
      "description": "メッセージ出力条件"
    },
    "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/message/

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

Example URI

GET /message/
Request
HideShow
Headers
Authorization: token
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "messages": [
    {
      "child_id": 1,
      "nickname": "sample",
      "child_messages": [
        {
          "goal_id": "sample",
          "content": "practice",
          "message_call": 2,
          "message": "practice"
        },
        {
          "goal_id": "index",
          "content": "test",
          "message_call": 5,
          "message": "sample"
        }
      ]
    },
    {
      "child_id": 2,
      "nickname": "index",
      "child_messages": [
        {
          "goal_id": "buf",
          "content": "sample",
          "message_call": 3,
          "message": "sample"
        },
        {
          "goal_id": "hoge",
          "content": "test",
          "message_call": 10,
          "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/message/{goal_id}/{message_call}

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

Example URI

DELETE /message/sample/5
URI Parameters
HideShow
goal_id
string (required) Example: sample
message_call
number (required) Example: 5
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"
    }
  }
}

プッシュ回数増加

ボタンプッシュ
PUT/thing/button

目標ボタンが押された回数を記録します。

Example URI

PUT /thing/button
Request
HideShow
Headers
Content-Type: applicaition/json
Body
{
  "device_id": "sample"
}
Schema
{
  "type": "object",
  "properties": {
    "device_id": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "angle": 72
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "angle": {
      "type": "number"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "error": "目標IDが見つかりません。"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}

Generated by aglio on 20 Jul 2018