ケーススタディ HAL大阪 API一覧
BOCCO × 目標ボタンAPI ¶
ユーザー登録 ¶
ユーザー情報の登録、およびサインインするためのAPI
サインアップPOST/signup
ユーザー情報の登録を行います。
Example URI
POST /signup
Request
Headers
Content-Type: applicaition/jsonBody
{
"name": "sample",
"pass": "password"
}Schema
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"pass": {
"type": "string"
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}Response
200Headers
Content-Type: application/jsonBody
{
"success": "ユーザー登録を行いました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "登録済みのユーザー名です。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}サインイン ¶
サインインPOST/signin
登録されているユーザー情報を元にサインインを行います。
Example URI
POST /signin
Request
Headers
Content-Type: applicaition/jsonBody
{
"name": "sample",
"pass": "password"
}Schema
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"pass": {
"type": "string"
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}Response
200Headers
Content-Type: application/jsonBody
{
"token": "sample"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}ユーザー削除 ¶
ユーザー削除DELETE/user
登録されているユーザー情報を削除します。
Example URI
DELETE /user
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "ユーザー情報を削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}子供情報設定 ¶
子供情報追加POST/child/
子供の誕生日と性別、ニックネームを設定します。
Example URI
POST /child/
Request
Headers
Content-Type: application/json
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"child_id": 1
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"child_id": {
"type": "number"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}子供情報取得GET/child/
子供ID,誕生日,ニックネーム,性別の一覧を取得します。
Example URI
GET /child/
Request
Headers
Content-Type: application/json
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"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
400Headers
Content-Type: application/jsonBody
{
"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
- child_id
string(required) Example: 1
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Content-Type: application/json
Authorization: tokenBody
{
"goal_id": "sample"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"goal_id": {
"type": "string"
}
}
}Response
200Headers
Content-Type: application/jsonBody
{
"pin": "0000"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"pin": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}デバイス一覧取得GET/device/
現在登録されているデバイスIDの一覧を取得します。
Example URI
GET /device/
Request
Headers
Content-Type: application/json
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"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
400Headers
Content-Type: application/jsonBody
{
"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
- device_id
string(required) Example: sample
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "ボタンIDを削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"success": "メールアドレスとパスワードを登録しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"email": "sample@gmail.com"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "メールアドレスとパスワードを削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}目標 ¶
目標登録POST/goal/
目標の新規追加を行います。
Example URI
POST /goal/
Request
Headers
Content-Type: application/json
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"goal_id": "sample"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"goal_id": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Content-Type: application/json
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"success": "登録しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}目標取得GET/goal/
登録されている目標と実行回数を取得します。
Example URI
GET /goal/
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"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
400Headers
Content-Type: application/jsonBody
{
"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
- goal_id
string(required) Example: sample
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "目標を削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}目標達成承認/非承認 ¶
達成数変更PUT/approval
目標実行数を変更します。
Example URI
PUT /approval
Request
Headers
Content-Type: application/json
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"success": "目標達成を承認しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}メッセージ ¶
メッセージ登録POST/message/
オリジナルメッセージの登録を行います。
Example URI
POST /message/
Request
Headers
Content-Type: application/json
Authorization: tokenBody
{
"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
200Headers
Content-Type: application/jsonBody
{
"success": "メッセージを編集しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "ログインエラー"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}メッセージ取得GET/message/
登録されているメッセージとメッセージ出力条件を取得します。
Example URI
GET /message/
Request
Headers
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"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
400Headers
Content-Type: application/jsonBody
{
"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
- goal_id
string(required) Example: sample- message_call
number(required) Example: 5
Request
Headers
Content-Type: application/json
Authorization: tokenResponse
200Headers
Content-Type: application/jsonBody
{
"success": "メッセージを削除しました。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"success": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Content-Type: applicaition/jsonBody
{
"pin": "0000"
}Schema
{
"type": "object",
"properties": {
"pin": {
"type": "string"
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}Response
200Headers
Content-Type: application/jsonBody
{
"device_id": "sample"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"device_id": {
"type": "string"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"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
Headers
Content-Type: applicaition/jsonBody
{
"device_id": "sample"
}Schema
{
"type": "object",
"properties": {
"device_id": {
"type": "string"
}
},
"$schema": "http://json-schema.org/draft-04/schema#"
}Response
200Headers
Content-Type: application/jsonBody
{
"angle": 72
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"angle": {
"type": "number"
}
}
}Response
400Headers
Content-Type: application/jsonBody
{
"error": "目標IDが見つかりません。"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}