API定義書

Qiita用ブラッシュアップ
未着手
ステータス
完了
作成日時
最終更新日時

新規ユーザー登録画面


API一覧

No.API名メソッドURI用途CRUD認証備考
1ユーザー登録POST/api/register新規登録C

API詳細

No.1 /api/register

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json"
		}

	【ボディ】
		{
			"name": "山田太郎",
			"email": "yamada@taro.com",
			"password": "Password",
			"password_confirmation": "Password"
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to store a new user.",
	  "user": {
	    "id": 1,
	    "name": "山田太郎",
	    "email": "yamada@taro.com"
	  }
	}
	
	【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
	    "name": ["50字以内で入力してください"],
	    "email": ["255字以内で入力してください"],
	    "password": ["8文字以上入力してください"]
	  }
	}
	
	【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to store a new user."
	}

ログイン画面


API一覧

No.API名メソッドURI用途CRUD認証備考
1ログインGET/api/loginログインR

API詳細

No.1 /api/login

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
			"email": "yamada@taro.com",
			"password": "Password"
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to login.",
	  "access_token": "1|sd5Xc8eOGN4gAp9fOaHk3JmE6lA1Khkx0lmA...",
	  "token_type": "Bearer",
	  "user": {
	    "id": 1,
	    "name": "山田太郎",
	    "email": "yamada@taro.com"
	  }
	}
	
	【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
	    "email": ["255字以内で入力してください"],
	    "password": ["8文字以上入力してください"]
	  }
	}
	
	【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to login."
	}

ユーザー情報編集画面


API一覧

No.API名メソッドURI用途CRUD認証備考
1ユーザー情報編集PATCH/api/user/meユーザー情報の更新U

API詳細

No.1 /api/user/me

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
		  "name": "田中次郎",
			"email": "yamada@taro.com",
			"password": "Password",
			"password_confirmation": "Password"
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to update a user information.",
	  "user": {
	    "id": 1,
	    "name": "山田次郎",
	    "email": "yamada@taro.com"
	  }
	}
	
	【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
	    "name": ["50字以内で入力してください"],
	    "email": ["255字以内で入力してください"],
	    "password": ["8文字以上入力してください"]
	  }
	}
	
	【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to update a user information."
	}

収支情報登録画面


API一覧

No.API名メソッドURI用途CRUD認証備考
1収支登録POST/api/transactions支出・収入の新規登録C収支の判断はtypeカラムで判断する。income | expense
2画像アップロードPOST/api/transactions/{transaction}/photo写真を登録(支出時のみ)C1の収支登録処理が成功後に行う。
3ジャンル一覧取得GET/api/genresプルダウン用のジャンル一覧取得Rジャンルを追加したいときのために、最後のoptionに「追加する」を用意し、押下するとモーダルにて新規登録が出来るようにする。
4ジャンル登録POST/api/genresジャンルの新規登録CこのAPI実行後、3のジャンル一覧取得を実行する。

API詳細

No.1 /api/transactions

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
		  "user_id": 1,
			"genre_id": 3,
			"type": "expense",
			"amount": 500,
			"date": "YYYY-MM-DD",
			"memo": "○○のために買った"
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to store a expense record.",
	  "transaction": {
		  "id": 1,
		  "user_id": 1,
			"genre_id": 3,
			"type": "expense",
			"amount": 500,
			"date": "YYYY-MM-DD",
			"memo": "○○のために買った",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"memo": ["255字以内で入力してください"],
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to store a new record."
	}

No.2 /api/transactions/{transaction}/photo

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "multipart/form-data",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【FormData】
		image: ファイル(画像)

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to store an image.",
	  "photo": {
		  "id": 1,
		  "transaction_id": 1,
			"image_path": "/images/flower.jpg",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to store an image."
	}

No.3 /api/genres

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "multipart/form-data",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
  なし

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to get genres.",
	  "genres": [{
		  "id": 1,
		  "name": "食費",
			"user_id": 1,
			"is_default": true,
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  },{
		  "id": 1,
		  "name": "交通費",
			"user_id": 1,
			"is_default": true,
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }]
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get genres."
	}

No.4 /api/genres

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
		  "name": "食費",
			"user_id": 1,
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to store a new genre.",
	  "genre": {
		  "id": 1,
		  "name": "食費",
			"user_id": 1,
			"is_default": true,
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"name": ["20字以内で入力してください"],
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to store a new genre."
	}

Dashboard


API一覧

No.API名メソッドURI用途CRUD認証備考
1今月の収支一覧取得GET/api/transactions?month=”YYYY-MM”カレンダーに表示する収支の取得Rカレンダーの月を移動するボタン押下時に発火。収支詳細もすぐに表示できるよう、すべてのカラムを取得する
2ダッシュボード情報取得GET/api/dashboardダッシュボードに表示する項目を返すR以下の項目を返す。
「今月の収入」「今月の支出」
「今月の残金」
「総資産」
「今月使用可能な額」
3ログアウトPOST/api/logoutログアウトUログアウト後、ログイン画面へ遷移する

No.1 /api/transactions?month=”YYYY-MM”

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to get transactions.",
	  "transactions": [{
		  "id": 1,
		  "user_id": 1,
			"genre_id": 3,
			"type": "expense",
			"amount": 500,
			"date": "YYYY-MM-DD",
			"memo": "○○のために買った",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  },{
		  "id": 2,
		  "user_id": 1,
			"genre_id": 2,
			"type": "expense",
			"amount": 1000,
			"date": "YYYY-MM-DD",
			"memo": null,
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }]
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get transactions."
	}

No.2 /api/dashboard

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to get informations.",
	  "summary": {
			"this_month_income": 10000,
			"this_month_expense": 1000,
			"remaining_amount": 9000,
			"total_balance": 39000,
			"available_amount": 5000
		}
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get informations."
	}

No.3 /api/logout

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to logout"
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to logout."
	}

固定費関係


API一覧

No.API名メソッドURI用途CRUD認証備考
1固定費一覧取得GET/api/fixed-costs固定費一覧の取得R固定費のすべての情報を取得し、フロントエンドで一覧表示と詳細表示で表示するカラムを調整する。
2固定費有効状態更新PATCH/api/fixed-costs/{fixed-cost}/is_active固定費の有効状態を更新Uトグル操作時にイベント発火
3固定費変更PATCH/api/fixed-costs/{fixed-cost}固定費の変更U固定費の有効状態以外を送る
4固定費登録POST/api/fixed-costs固定費の新規登録C固定費の有効状態以外を送る
5固定費削除DELETE/api/fixed-costs/{fixed-cost}固定費の削除D

No.4 /api/fixed-costs

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to get fixed-costs.",
	  "fixed-costs": [{
		  "id": 1,
		  "user_id": 1,
			"genre": {
      "id": 3,
      "name": "住居"
	    },
			"name": "家賃",
			"amount": "80000",
			"day_of_month": 10,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_occurence_date": "2025-06-10",
			"is_active": true,
			"memo": "",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  },{
		  "id": 2,
		  "user_id": 1,
			"genre": {
	      "id": 4,
	      "name": "インフラ"
	    },
			"name": "通信代",
			"amount": "8000",
			"day_of_month": 2,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_occurence_date": "2025-06-02",
			"is_active": true,
			"memo": "",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }]
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get fixed-costs."
	}

No.2 /api/fixed-costs/{fixed-costs}/is_active

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
			"X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to change the fixed-cost's is_active state.",
	  "fixed_cost": {
		  "id": 1,
			"is_active": true,
			"updated_at": "YYYY-MM-DD-HH:MM"
		}
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to change the fixed-cost's is_active state."
	}

No.3 /api/fixed-costs/{fixed-costs}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
			"genre_id": 3
			"name": "家賃",
			"amount": "80000",
			"day_of_month": 10,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_active": true,
			"memo": "",
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to change the fixed-cost."
		"fixed-costs": {
		  "id": 1,
		  "user_id": 1,
			"genre": {
      "id": 3,
      "name": "住居"
	    },
			"name": "家賃",
			"amount": "80000",
			"day_of_month": 10,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_occurence_date": "2025-06-10",
			"is_active": true,
			"memo": "",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }
	}
	
	
 【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"name": ["20字以内で入力してください"],
			"memo": ["255字以内で入力してください"],
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to change the fixed-cost"
	}

No.4 /api/fixed-costs

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		{
			"genre_id": 3,
			"name": "家賃",
			"amount": "80000",
			"day_of_month": 10,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_active": true,
			"memo": "",
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	  "message": "Success to store a new fixed-cost."
		"fixed-costs": {
		  "id": 1,
		  "user_id": 1,
			"genre": {
      "id": 3,
      "name": "住居"
	    },
			"name": "家賃",
			"amount": "80000",
			"day_of_month": 10,
			"interval_months": 1,
			"start_date": "2025-05-20",
			"is_occurence_date": "2025-06-10",
			"is_active": true,
			"memo": "",
			"created_at": "YYYY-MM-DD-HH:MM",
			"updated_at": null
	  }
	}
	
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"name": ["20字以内で入力してください"],
			"memo": ["255字以内で入力してください"],
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to store a new fixed-cost"
	}

No.5 /api/fixed-costs/{fixed-costs}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}

	【ボディ】
		なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	  "message": "Success to delete a task. task_id = 1"
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to delete the task."
	}

貯金目標一覧


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金目標一覧取得GET/api/saving-goals貯金目標一覧の取得R固定費のid,name,と現在の貯金額を計算して返す

No.1 /api/saving-goals

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to get saving_goals.",
	 "saving_goals": [
	    {
	      "id": 1,
	      "name": "海外旅行",
	      "target_amount": 100000,
	      "saving_amount": 50000,
	      "deadline": "2025-09-01"
	    },
	    {
	      "id": 2,
	      "name": "将来のための貯金",
	      "target_amount": 200000,
	      "saving_amount": 100000,
	      "deadline": "2026-01-01"
	    }
	  ]
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get saving_goals."
	}

貯金目標詳細


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金目標詳細取得GET/api/saving-goals/{saving-goal}貯金目標詳細の取得Rsaving_goalsの全カラムと外部キーにそのsaving_goalのidを持っているsaving_progressの全カラムを取得。また、現在の貯金状況を判断するメッセージも取得。(このままのペースで行けば達成できます!やこのままのペースで行くと、締切日時点で〇円足りなくなります。)
2貯金目標削除DELETE/api/saving-goals/{saving-goal}貯金目標の削除D貯金目標を削除すると、今まで記録していた貯金履歴も削除される。
3貯金履歴削除DELETE/api/saving-progresses/{saving-progress}貯金履歴の削除D
4貯金目標有効化変更PATCH/api/saving-progresses/{saving-progress}/is_active貯金目標の有効化カラムの変更U

No.1 /api/saving_goals/{saving_goal}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to get the saving_goal summary.",
	 "summary": {
		 "saving_goal": {
	      "id": 1,
	      "name": "海外旅行",
	      "target_amount": 1000000,
	      "deadline": "YYYY-MM-DD",
	      "auto_monthly_amount": 50000,
	      "is_active": true,
	      "created_at": "YYYY-MM-DD",
	      "updated_at": "YYYY-MM-DD"
		 },
		 "saving_progresses": [{
			 "id": 1,
			 "saving_goal_id": 1,
			 "amount": 50000,
			 "date": "YYYY-MM-DD",
	     "created_at": "YYYY-MM-DD",
	     "updated_at": "YYYY-MM-DD"
		 }],
		 "circumstance": {
			 "message": "このままのペースで行けば達成できます!",
			 "saving_amount": 50000
		 }
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to get saving_goal summary."
	}

No.2 /api/saving_goals/{saving_goal}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to delete a saving_goal and related saving_progresses. id=1"
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to delete a saving_goal and related saving_progresses. id=1"
	}

No.3 /api/saving_progresses/{saving_progress}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to delete a saving_progresses. id=1"
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to delete a saving_progresses. id=1"
	}

No.4 /api/saving-goals/{saving-goal}/is_active

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
	 なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to toggle the saving_goal's is_active status.",
	 "saving_progress": {
		 "id": 1,
		 "is_active": false,
     "updated_at": "2025-05-18T10:30:00"
	 }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to toggle the saving_goal's is_active status."
	}

貯金目標登録


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金目標詳登録POST/api/saving-goals貯金目標の新規登録C
💡

月次貯金金額の計算はフロントエンド側で処理する

No.1 /api/saving-goals

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		{
			"name": "海外旅行",
			"target_amount": 1000000,
			"deadline": "YYYY-MM-DD",
			"auto_monthly_amount": 50000
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	 "message": "Success to create a new saving_goal.",
	 "saving_goal": {
      "id": 1,
      "name": "海外旅行",
      "target_amount": 1000000,
      "deadline": "YYYY-MM-DD",
      "auto_monthly_amount": 50000,
      "is_active": true,
      "created_at": "YYYY-MM-DD",
      "updated_at": "YYYY-MM-DD"
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"name": ["20字以内で入力してください"],
			"deadline": ["今日よりも後の日付を設定してください"]
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to create a new saving_goal."
	}

貯金目標編集


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金目標詳編集PATCH/api/saving-goals/{saving-goal}貯金目標の編集U

No.1 /api/saving-goals/{saving-goal}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		{
			"name": "海外旅行",
			"target_amount": 1000000,
			"deadline": "YYYY-MM-DD",
			"auto_monthly_amount": 50000
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to update the saving_goal.",
	 "saving_goal": {
      "id": 1,
      "name": "海外旅行",
      "target_amount": 1000000,
      "deadline": "YYYY-MM-DD",
      "auto_monthly_amount": 50000,
      "is_active": true,
      "created_at": "YYYY-MM-DD",
      "updated_at": "YYYY-MM-DD"
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"name": ["20字以内で入力してください"],
			"deadline": ["今日より30日以上先の日付を設定してください"]
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to update the saving_goal."
	}

貯金履歴登録


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金履歴登録POST/api/saving-goals/{saving-goal}/saving-progresses貯金履歴の新規登録C

No.1 /api/saving-goals/{saving-goal}/saving-progresses

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		{
			"date": "YYYY-MM-DD",
			"amount": 50000,
			"memo": "今月余裕があったので追加貯金",
		}

レスポンス

【成功時】
	ステータスコード: 201 Created
	{
	 "message": "Success to create a new saving_progress.",
	 "saving_progress": {
      "id": 1,
      "user_id": 1,
      "amount": 50000,
      "date": "YYYY-MM-DD",
      "memo": "今月余裕があったので追加貯金",
      "created_at": "YYYY-MM-DD",
      "updated_at": null
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"memo": ["255字以内で入力してください"]
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to create a new saving_progress."
	}

貯金履歴編集


fAPI一覧

No.API名メソッドURI用途CRUD認証備考
1貯金履歴編集PATCH/api/saving-goals/{saving-goal}/saving-progresses/{saving-progress}貯金履歴の編集U

No.1 /api/saving-goals/{saving-goal}/saving-progresses/{saving-progress}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		{
			"date": "YYYY-MM-DD",
			"amount": 50000,
			"memo": "今月余裕があったので追加貯金",
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to update the saving_progress.",
	 "saving_progress": {
      "id": 1,
      "user_id": 1,
      "amount": 50000,
      "date": "YYYY-MM-DD",
      "memo": "今月余裕があったので追加貯金",
      "created_at": "YYYY-MM-DD",
      "updated_at": "YYYY-MM-DD"
	  }
	}
	
【バリデーションエラー】
	ステータスコード: 422 Unprocessable Entity
	{
	  "message": "The given data was invalid.",
	  "errors": {
			"memo": ["255字以内で入力してください"]
	  }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to update the saving_progress."
	}

貯金履歴削除


API一覧

No.API名メソッドURI用途CRUD認証備考
1貯金履歴削除DELETE/api/saving-goals/{saving-goal}/saving-progresses/{saving-progress}貯金履歴の削除Dバックエンドで、saving-goalとsaving-progressのリレーション関係が成立しているかを必ず確かめる

No.1 /api/saving-goals/{saving-goal}/saving-progresses/{saving-progress}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to delete the saving_progress. id=1"
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to delete the saving_progress. id=1"
	}

貯金履歴削除


API一覧

No.API名メソッドURI用途CRUD認証備考
1ジャンル編集PATCH/api/genres/{genre}ジャンルの編集U
2ジャンル削除DELETE/api/genres/{genre}ジャンル削除D

No.1 /api/genres/{genre}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		{
			"name": "交通費"
		}

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to update the genre.",
	 "genre": {
		 "id": 1,
		 "name": "交通費",
		 "created_at": "YYYY-MM-DD",
		 "updated_at": "YYYY-MM-DD"
	 }
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to update the genre."
	}

No.2 /api/genres/{genre}

リクエスト

	【ヘッダー】
		{
		  "Accept": "application/json",
		  "Content-Type": "application/json",
		  "X-XSRF-TOKEN": "取得したトークン",
		  "withCredentials": true
		}
	【ボディ】
		なし

レスポンス

【成功時】
	ステータスコード: 200 OK
	{
	 "message": "Success to delete the genre. id=1."
	}
	
【サーバーエラー】
	ステータスコード: 500 Internal Server Error
	{
	  "message": "Failed to delete the genre. id=1."
	}