firefly-iii/routes/api.php

503 lines
24 KiB
PHP
Raw Normal View History

2016-09-15 23:19:40 -05:00
<?php
2019-02-09 03:36:59 -06:00
/**
* api.php
2020-07-02 22:59:36 -05:00
* Copyright (c) 2020 james@firefly-iii.org
2019-02-09 03:36:59 -06:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2019-02-09 03:36:59 -06:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2019-02-09 03:36:59 -06:00
*
* This program is distributed in the hope that it will be useful,
2019-02-09 03:36:59 -06:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2019-02-09 03:36:59 -06:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2019-02-09 03:36:59 -06:00
*/
2020-07-02 22:59:36 -05:00
declare(strict_types=1);
2020-03-19 22:42:19 -05:00
use FireflyIII\Http\Middleware\IsAdmin;
2018-02-13 11:24:06 -06:00
Route::group(
2019-08-15 22:08:56 -05:00
[
'namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'about',
2020-03-20 12:23:21 -05:00
'as' => 'api.v1.about.'],
static function () {
2018-02-13 11:24:06 -06:00
// Accounts API routes:
Route::get('', ['uses' => 'AboutController@about', 'as' => 'index']);
Route::get('user', ['uses' => 'AboutController@user', 'as' => 'user']);
}
);
2018-02-04 08:57:35 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'accounts',
'as' => 'api.v1.accounts.',],
static function () {
2018-02-11 01:08:08 -06:00
// Accounts API routes:
Route::get('', ['uses' => 'AccountController@index', 'as' => 'index']);
Route::post('', ['uses' => 'AccountController@store', 'as' => 'store']);
Route::get('{account}', ['uses' => 'AccountController@show', 'as' => 'show']);
Route::put('{account}', ['uses' => 'AccountController@update', 'as' => 'update']);
Route::delete('{account}', ['uses' => 'AccountController@delete', 'as' => 'delete']);
2018-12-09 06:09:43 -06:00
Route::get('{account}/piggy_banks', ['uses' => 'AccountController@piggyBanks', 'as' => 'piggy_banks']);
Route::get('{account}/transactions', ['uses' => 'AccountController@transactions', 'as' => 'transactions']);
2020-03-19 22:42:19 -05:00
Route::get('{account}/attachments', ['uses' => 'AccountController@attachments', 'as' => 'attachments']);
2018-02-11 01:08:08 -06:00
}
);
Route::group(
['namespace' => 'FireflyIII\Api\V1\Controllers\Autocomplete', 'prefix' => 'autocomplete',
'as' => 'api.v1.autocomplete.',],
static function () {
// Auto complete routes
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
2020-07-19 10:05:37 -05:00
Route::get('bills', ['uses' => 'BillController@bills', 'as' => 'bills']);
2020-07-19 10:24:29 -05:00
Route::get('budgets', ['uses' => 'BudgetController@budgets', 'as' => 'budgets']);
Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);
2020-07-20 23:09:24 -05:00
Route::get('currencies', ['uses' => 'CurrencyController@currencies', 'as' => 'currencies']);
2020-07-22 13:17:20 -05:00
Route::get('currencies-with-code', ['uses' => 'CurrencyController@currenciesWithCode', 'as' => 'currencies-with-code']);
2020-07-20 23:09:24 -05:00
Route::get('object-groups', ['uses' => 'ObjectGroupController@objectGroups', 'as' => 'object-groups']);
2020-07-22 13:17:20 -05:00
Route::get('piggy-banks', ['uses' => 'PiggyBankController@piggyBanks', 'as' => 'piggy-banks']);
Route::get('piggy-banks-with-balance', ['uses' => 'PiggyBankController@piggyBanksWithBalance', 'as' => 'piggy-banks-with-balance']);
2020-07-22 23:19:34 -05:00
Route::get('tags', ['uses' => 'TagController@tags', 'as' => 'tags']);
2020-07-23 10:58:53 -05:00
Route::get('transactions', ['uses' => 'TransactionController@transactions', 'as' => 'transactions']);
2020-07-23 12:34:17 -05:00
Route::get('transactions-with-id', ['uses' => 'TransactionController@transactionsWithID', 'as' => 'transactions-with-id']);
Route::get('transaction-types', ['uses' => 'TransactionTypeController@transactionTypes', 'as' => 'transaction-types']);
}
);
2020-06-20 09:28:23 -05:00
Route::group(
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'groups',
'as' => 'api.v1.object-groups.',],
static function () {
// Accounts API routes:
Route::get('', ['uses' => 'ObjectGroupController@index', 'as' => 'index']);
Route::get('{objectGroup}', ['uses' => 'ObjectGroupController@show', 'as' => 'show']);
Route::put('{objectGroup}', ['uses' => 'ObjectGroupController@update', 'as' => 'update']);
Route::delete('{objectGroup}', ['uses' => 'ObjectGroupController@delete', 'as' => 'delete']);
Route::get('{objectGroup}/piggy_banks', ['uses' => 'ObjectGroupController@piggyBanks', 'as' => 'piggy_banks']);
}
);
2018-06-23 23:51:22 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'attachments',
'as' => 'api.v1.attachments.',],
static function () {
2018-06-23 23:51:22 -05:00
2018-06-24 01:33:06 -05:00
// Attachment API routes:
2018-06-23 23:51:22 -05:00
Route::get('', ['uses' => 'AttachmentController@index', 'as' => 'index']);
Route::post('', ['uses' => 'AttachmentController@store', 'as' => 'store']);
Route::get('{attachment}', ['uses' => 'AttachmentController@show', 'as' => 'show']);
Route::get('{attachment}/download', ['uses' => 'AttachmentController@download', 'as' => 'download']);
Route::post('{attachment}/upload', ['uses' => 'AttachmentController@upload', 'as' => 'upload']);
Route::put('{attachment}', ['uses' => 'AttachmentController@update', 'as' => 'update']);
Route::delete('{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'delete']);
}
);
2018-06-24 01:33:06 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'available_budgets',
'as' => 'api.v1.available_budgets.',],
static function () {
2018-06-24 01:33:06 -05:00
// Available Budget API routes:
Route::get('', ['uses' => 'AvailableBudgetController@index', 'as' => 'index']);
Route::post('', ['uses' => 'AvailableBudgetController@store', 'as' => 'store']);
Route::get('{availableBudget}', ['uses' => 'AvailableBudgetController@show', 'as' => 'show']);
Route::put('{availableBudget}', ['uses' => 'AvailableBudgetController@update', 'as' => 'update']);
Route::delete('{availableBudget}', ['uses' => 'AvailableBudgetController@delete', 'as' => 'delete']);
}
);
2018-12-09 06:09:43 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'bills',
'as' => 'api.v1.bills.',],
static function () {
2018-12-09 06:09:43 -06:00
// Bills API routes:
2020-03-19 22:42:19 -05:00
Route::get('', ['uses' => 'BillController@index', 'as' => 'index']);
Route::post('', ['uses' => 'BillController@store', 'as' => 'store']);
Route::get('{bill}', ['uses' => 'BillController@show', 'as' => 'show']);
Route::put('{bill}', ['uses' => 'BillController@update', 'as' => 'update']);
Route::delete('{bill}', ['uses' => 'BillController@delete', 'as' => 'delete']);
Route::get('{bill}/attachments', ['uses' => 'BillController@attachments', 'as' => 'attachments']);
Route::get('{bill}/rules', ['uses' => 'BillController@rules', 'as' => 'rules']);
Route::get('{bill}/transactions', ['uses' => 'BillController@transactions', 'as' => 'transactions']);
}
2018-12-09 06:09:43 -06:00
);
2018-06-24 06:20:29 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'budgets/limits',
'as' => 'api.v1.budget_limits.',],
static function () {
2018-06-24 06:20:29 -05:00
// Budget Limit API routes:
Route::get('', ['uses' => 'BudgetLimitController@index', 'as' => 'index']);
Route::post('', ['uses' => 'BudgetLimitController@store', 'as' => 'store']);
Route::get('{budgetLimit}', ['uses' => 'BudgetLimitController@show', 'as' => 'show']);
Route::put('{budgetLimit}', ['uses' => 'BudgetLimitController@update', 'as' => 'update']);
Route::delete('{budgetLimit}', ['uses' => 'BudgetLimitController@delete', 'as' => 'delete']);
2020-03-19 22:42:19 -05:00
2018-12-09 01:45:53 -06:00
Route::get('{budgetLimit}/transactions', ['uses' => 'BudgetLimitController@transactions', 'as' => 'transactions']);
2018-06-24 06:20:29 -05:00
}
);
2018-06-24 07:54:06 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'budgets',
'as' => 'api.v1.budgets.',],
static function () {
2018-06-24 07:54:06 -05:00
// Budget API routes:
Route::get('', ['uses' => 'BudgetController@index', 'as' => 'index']);
Route::post('', ['uses' => 'BudgetController@store', 'as' => 'store']);
Route::get('{budget}', ['uses' => 'BudgetController@show', 'as' => 'show']);
Route::put('{budget}', ['uses' => 'BudgetController@update', 'as' => 'update']);
Route::delete('{budget}', ['uses' => 'BudgetController@delete', 'as' => 'delete']);
2020-08-02 04:53:04 -05:00
Route::post('{budget}/limits', ['uses' => 'BudgetLimitController@store', 'as' => 'store_budget_limit']);
2020-03-19 22:42:19 -05:00
2018-12-09 01:45:53 -06:00
Route::get('{budget}/transactions', ['uses' => 'BudgetController@transactions', 'as' => 'transactions']);
2020-03-19 22:42:19 -05:00
Route::get('{budget}/attachments', ['uses' => 'BudgetController@attachments', 'as' => 'attachments']);
2018-12-09 01:45:53 -06:00
Route::get('{budget}/limits', ['uses' => 'BudgetController@budgetLimits', 'as' => 'budget_limits']);
2018-06-24 07:54:06 -05:00
}
);
2018-06-24 08:05:59 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'categories',
'as' => 'api.v1.categories.',],
static function () {
2018-06-24 08:05:59 -05:00
// Category API routes:
Route::get('', ['uses' => 'CategoryController@index', 'as' => 'index']);
Route::post('', ['uses' => 'CategoryController@store', 'as' => 'store']);
Route::get('{category}', ['uses' => 'CategoryController@show', 'as' => 'show']);
Route::put('{category}', ['uses' => 'CategoryController@update', 'as' => 'update']);
Route::delete('{category}', ['uses' => 'CategoryController@delete', 'as' => 'delete']);
2020-03-19 22:42:19 -05:00
2018-12-08 23:58:03 -06:00
Route::get('{category}/transactions', ['uses' => 'CategoryController@transactions', 'as' => 'transactions']);
2020-03-19 22:42:19 -05:00
Route::get('{category}/attachments', ['uses' => 'CategoryController@attachments', 'as' => 'attachments']);
2018-06-24 08:05:59 -05:00
}
);
2019-01-26 13:19:06 -06:00
/**
2020-03-17 11:06:30 -05:00
* CHART ROUTES.
2019-01-26 13:19:06 -06:00
*/
// Accounts
2019-01-17 22:38:23 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers\Chart', 'prefix' => 'chart/account',
'as' => 'api.v1.chart.account.',],
static function () {
2019-01-17 22:38:23 -06:00
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
2019-01-26 13:19:06 -06:00
Route::get('expense', ['uses' => 'AccountController@expenseOverview', 'as' => 'expense']);
Route::get('revenue', ['uses' => 'AccountController@revenueOverview', 'as' => 'revenue']);
2019-01-17 22:38:23 -06:00
}
);
2019-01-26 13:19:06 -06:00
// Available budgets
2019-01-26 05:11:45 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers\Chart', 'prefix' => 'chart/ab',
'as' => 'api.v1.chart.ab.',],
static function () {
2019-01-26 05:11:45 -06:00
// Overview API routes:
Route::get('overview/{availableBudget}', ['uses' => 'AvailableBudgetController@overview', 'as' => 'overview']);
}
);
// Budgets
Route::group(
['namespace' => 'FireflyIII\Api\V1\Controllers\Chart', 'prefix' => 'chart/budget',
'as' => 'api.v1.chart.budget.',],
static function () {
// (frontpage) budget overview
Route::get('overview', ['uses' => 'BudgetController@overview', 'as' => 'overview']);
}
);
2019-02-03 00:51:34 -06:00
// Categories
2019-01-26 13:19:06 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers\Chart', 'prefix' => 'chart/category',
'as' => 'api.v1.chart.category.',],
static function () {
2019-01-26 13:19:06 -06:00
// Overview API routes:
Route::get('overview', ['uses' => 'CategoryController@overview', 'as' => 'overview']);
}
);
2020-07-05 11:29:58 -05:00
// Configuration
2018-06-24 08:33:36 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'configuration',
'as' => 'api.v1.configuration.',],
static function () {
2018-06-24 08:33:36 -05:00
// Configuration API routes:
Route::get('', ['uses' => 'ConfigurationController@index', 'as' => 'index']);
2018-12-08 23:39:56 -06:00
Route::post('{configName}', ['uses' => 'ConfigurationController@update', 'as' => 'update']);
2018-06-24 08:33:36 -05:00
}
);
2018-02-16 08:18:07 -06:00
2018-06-28 00:32:58 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'cer',
'as' => 'api.v1.cer.',],
static function () {
2018-06-28 00:32:58 -05:00
// Currency Exchange Rate API routes:
Route::get('', ['uses' => 'CurrencyExchangeRateController@index', 'as' => 'index']);
}
);
2018-06-28 15:14:50 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'link_types',
'as' => 'api.v1.link_types.',],
static function () {
2018-06-28 15:14:50 -05:00
// Link Type API routes:
Route::get('', ['uses' => 'LinkTypeController@index', 'as' => 'index']);
Route::post('', ['uses' => 'LinkTypeController@store', 'as' => 'store']);
Route::get('{linkType}', ['uses' => 'LinkTypeController@show', 'as' => 'show']);
Route::put('{linkType}', ['uses' => 'LinkTypeController@update', 'as' => 'update']);
Route::delete('{linkType}', ['uses' => 'LinkTypeController@delete', 'as' => 'delete']);
2018-12-08 00:57:29 -06:00
Route::get('{linkType}/transactions', ['uses' => 'LinkTypeController@transactions', 'as' => 'transactions']);
}
);
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'transaction_links',
'as' => 'api.v1.transaction_links.',],
static function () {
2018-12-08 00:57:29 -06:00
// Transaction Links API routes:
Route::get('', ['uses' => 'TransactionLinkController@index', 'as' => 'index']);
Route::post('', ['uses' => 'TransactionLinkController@store', 'as' => 'store']);
Route::get('{journalLink}', ['uses' => 'TransactionLinkController@show', 'as' => 'show']);
Route::put('{journalLink}', ['uses' => 'TransactionLinkController@update', 'as' => 'update']);
Route::delete('{journalLink}', ['uses' => 'TransactionLinkController@delete', 'as' => 'delete']);
2018-06-28 15:14:50 -05:00
}
);
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'piggy_banks',
'as' => 'api.v1.piggy_banks.',],
static function () {
2018-06-28 15:14:50 -05:00
// Piggy Bank API routes:
Route::get('', ['uses' => 'PiggyBankController@index', 'as' => 'index']);
Route::post('', ['uses' => 'PiggyBankController@store', 'as' => 'store']);
Route::get('{piggyBank}', ['uses' => 'PiggyBankController@show', 'as' => 'show']);
Route::put('{piggyBank}', ['uses' => 'PiggyBankController@update', 'as' => 'update']);
Route::delete('{piggyBank}', ['uses' => 'PiggyBankController@delete', 'as' => 'delete']);
2020-03-19 22:42:19 -05:00
Route::get('{piggyBank}/events', ['uses' => 'PiggyBankController@piggyBankEvents', 'as' => 'events']);
Route::get('{piggyBank}/attachments', ['uses' => 'PiggyBankController@attachments', 'as' => 'attachments']);
2018-06-28 15:14:50 -05:00
}
);
2018-06-29 05:11:44 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'preferences',
'as' => 'api.v1.preferences.',],
static function () {
2018-06-29 05:11:44 -05:00
2018-06-29 07:07:33 -05:00
// Preference API routes:
2018-06-29 05:11:44 -05:00
Route::get('', ['uses' => 'PreferenceController@index', 'as' => 'index']);
2019-01-26 05:11:45 -06:00
Route::get('{preference}', ['uses' => 'PreferenceController@show', 'as' => 'show']);
2018-06-29 05:28:29 -05:00
Route::put('{preference}', ['uses' => 'PreferenceController@update', 'as' => 'update']);
2018-06-29 07:07:33 -05:00
}
);
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'recurrences',
'as' => 'api.v1.recurrences.',],
static function () {
2018-06-29 07:07:33 -05:00
// Recurrence API routes:
Route::get('', ['uses' => 'RecurrenceController@index', 'as' => 'index']);
Route::post('', ['uses' => 'RecurrenceController@store', 'as' => 'store']);
2018-12-07 13:20:54 -06:00
Route::post('trigger', ['uses' => 'RecurrenceController@trigger', 'as' => 'trigger']);
2018-06-29 07:07:33 -05:00
Route::get('{recurrence}', ['uses' => 'RecurrenceController@show', 'as' => 'show']);
Route::put('{recurrence}', ['uses' => 'RecurrenceController@update', 'as' => 'update']);
Route::delete('{recurrence}', ['uses' => 'RecurrenceController@delete', 'as' => 'delete']);
2018-12-07 13:20:54 -06:00
Route::get('{recurrence}/transactions', ['uses' => 'RecurrenceController@transactions', 'as' => 'transactions']);
2018-06-29 05:11:44 -05:00
}
);
2018-06-30 09:46:51 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'rules',
'as' => 'api.v1.rules.',],
static function () {
2018-06-30 09:46:51 -05:00
// Rules API routes:
Route::get('', ['uses' => 'RuleController@index', 'as' => 'index']);
Route::post('', ['uses' => 'RuleController@store', 'as' => 'store']);
Route::get('{rule}', ['uses' => 'RuleController@show', 'as' => 'show']);
Route::put('{rule}', ['uses' => 'RuleController@update', 'as' => 'update']);
Route::delete('{rule}', ['uses' => 'RuleController@delete', 'as' => 'delete']);
2018-12-07 09:03:05 -06:00
Route::get('{rule}/test', ['uses' => 'RuleController@testRule', 'as' => 'test']);
Route::post('{rule}/trigger', ['uses' => 'RuleController@triggerRule', 'as' => 'trigger']);
2019-06-09 01:26:23 -05:00
Route::post('{rule}/up', ['uses' => 'RuleController@moveUp', 'as' => 'up']);
Route::post('{rule}/down', ['uses' => 'RuleController@moveDown', 'as' => 'down']);
2018-06-30 09:46:51 -05:00
}
);
2018-06-30 11:10:54 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'rule_groups',
'as' => 'api.v1.rule_groups.',],
static function () {
2018-06-30 11:10:54 -05:00
// Rules API routes:
Route::get('', ['uses' => 'RuleGroupController@index', 'as' => 'index']);
Route::post('', ['uses' => 'RuleGroupController@store', 'as' => 'store']);
Route::get('{ruleGroup}', ['uses' => 'RuleGroupController@show', 'as' => 'show']);
Route::put('{ruleGroup}', ['uses' => 'RuleGroupController@update', 'as' => 'update']);
Route::delete('{ruleGroup}', ['uses' => 'RuleGroupController@delete', 'as' => 'delete']);
2018-12-07 09:03:05 -06:00
Route::get('{ruleGroup}/test', ['uses' => 'RuleGroupController@testGroup', 'as' => 'test']);
Route::get('{ruleGroup}/rules', ['uses' => 'RuleGroupController@rules', 'as' => 'rules']);
Route::post('{ruleGroup}/trigger', ['uses' => 'RuleGroupController@triggerGroup', 'as' => 'trigger']);
2019-06-05 12:38:28 -05:00
Route::post('{ruleGroup}/up', ['uses' => 'RuleGroupController@moveUp', 'as' => 'up']);
Route::post('{ruleGroup}/down', ['uses' => 'RuleGroupController@moveDown', 'as' => 'down']);
2018-06-30 11:10:54 -05:00
}
);
2019-10-02 11:00:01 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers\Search', 'prefix' => 'search',
'as' => 'api.v1.search.',],
2019-10-02 11:00:01 -05:00
static function () {
// Attachment API routes:
Route::get('transactions', ['uses' => 'TransactionController@search', 'as' => 'transactions']);
Route::get('accounts', ['uses' => 'AccountController@search', 'as' => 'accounts']);
}
);
2019-01-17 22:38:23 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'summary',
'as' => 'api.v1.summary.',],
static function () {
2019-01-17 22:38:23 -06:00
// Overview API routes:
Route::get('basic', ['uses' => 'SummaryController@basic', 'as' => 'basic']);
}
);
2020-07-11 08:13:15 -05:00
Route::group(
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'data',
'as' => 'api.v1.data.',],
static function () {
// Overview API routes:
Route::delete('destroy', ['uses' => 'Data\DestroyController@destroy', 'as' => 'destroy']);
}
);
2018-04-13 10:28:11 -05:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'currencies',
'as' => 'api.v1.currencies.',],
static function () {
2018-06-24 08:05:59 -05:00
// Transaction currency API routes:
Route::get('', ['uses' => 'CurrencyController@index', 'as' => 'index']);
Route::post('', ['uses' => 'CurrencyController@store', 'as' => 'store']);
2020-03-19 22:42:19 -05:00
Route::get('default', ['uses' => 'CurrencyController@showDefault', 'as' => 'show.default']);
2018-12-08 14:26:20 -06:00
Route::get('{currency_code}', ['uses' => 'CurrencyController@show', 'as' => 'show']);
Route::put('{currency_code}', ['uses' => 'CurrencyController@update', 'as' => 'update']);
Route::delete('{currency_code}', ['uses' => 'CurrencyController@delete', 'as' => 'delete']);
Route::post('{currency_code}/enable', ['uses' => 'CurrencyController@enable', 'as' => 'enable']);
Route::post('{currency_code}/disable', ['uses' => 'CurrencyController@disable', 'as' => 'disable']);
Route::post('{currency_code}/default', ['uses' => 'CurrencyController@makeDefault', 'as' => 'default']);
Route::get('{currency_code}/accounts', ['uses' => 'CurrencyController@accounts', 'as' => 'accounts']);
Route::get('{currency_code}/available_budgets', ['uses' => 'CurrencyController@availableBudgets', 'as' => 'available_budgets']);
Route::get('{currency_code}/bills', ['uses' => 'CurrencyController@bills', 'as' => 'bills']);
Route::get('{currency_code}/budget_limits', ['uses' => 'CurrencyController@budgetLimits', 'as' => 'budget_limits']);
Route::get('{currency_code}/cer', ['uses' => 'CurrencyController@cer', 'as' => 'cer']);
Route::get('{currency_code}/recurrences', ['uses' => 'CurrencyController@recurrences', 'as' => 'recurrences']);
Route::get('{currency_code}/rules', ['uses' => 'CurrencyController@rules', 'as' => 'rules']);
Route::get('{currency_code}/transactions', ['uses' => 'CurrencyController@transactions', 'as' => 'transactions']);
2018-06-24 08:05:59 -05:00
}
2018-04-13 10:28:11 -05:00
);
2018-12-05 12:12:38 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'tags',
'as' => 'api.v1.tags.',],
static function () {
2019-01-26 13:19:06 -06:00
// Tag API routes:
2018-12-05 12:12:38 -06:00
Route::get('', ['uses' => 'TagController@index', 'as' => 'index']);
Route::post('', ['uses' => 'TagController@store', 'as' => 'store']);
Route::get('{tagOrId}', ['uses' => 'TagController@show', 'as' => 'show']);
Route::put('{tagOrId}', ['uses' => 'TagController@update', 'as' => 'update']);
Route::delete('{tagOrId}', ['uses' => 'TagController@delete', 'as' => 'delete']);
2020-03-19 22:42:19 -05:00
2018-12-12 13:30:25 -06:00
Route::get('{tagOrId}/transactions', ['uses' => 'TagController@transactions', 'as' => 'transactions']);
2020-03-19 22:42:19 -05:00
Route::get('{tagOrId}/attachments', ['uses' => 'TagController@attachments', 'as' => 'attachments']);
2018-12-05 12:12:38 -06:00
}
);
2019-01-26 13:19:06 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'tag-cloud',
'as' => 'api.v1.tag-cloud.',],
static function () {
2019-01-26 13:19:06 -06:00
// Tag cloud API routes (to prevent collisions)
Route::get('', ['uses' => 'TagController@cloud', 'as' => 'cloud']);
}
);
2018-02-16 08:18:07 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'transactions',
'as' => 'api.v1.transactions.',],
static function () {
2018-02-16 08:18:07 -06:00
2018-03-03 01:12:18 -06:00
// Transaction API routes:
2018-02-16 08:18:07 -06:00
Route::get('', ['uses' => 'TransactionController@index', 'as' => 'index']);
Route::post('', ['uses' => 'TransactionController@store', 'as' => 'store']);
2019-03-30 01:09:52 -05:00
Route::get('{transactionGroup}', ['uses' => 'TransactionController@show', 'as' => 'show']);
2019-09-26 13:57:24 -05:00
Route::get('{transactionGroup}/attachments', ['uses' => 'TransactionController@attachments', 'as' => 'attachments']);
Route::get('{transactionGroup}/piggy_bank_events', ['uses' => 'TransactionController@piggyBankEvents', 'as' => 'piggy_bank_events']);
2020-08-07 04:10:35 -05:00
Route::get('{tj}/transaction_links', ['uses' => 'TransactionController@transactionLinks', 'as' => 'transaction_links']);
2019-03-30 01:09:52 -05:00
Route::put('{transactionGroup}', ['uses' => 'TransactionController@update', 'as' => 'update']);
2020-08-07 04:10:35 -05:00
Route::delete('{transactionGroup}/{tj}', ['uses' => 'TransactionController@deleteJournal', 'as' => 'delete-journal']);
2019-03-30 01:09:52 -05:00
Route::delete('{transactionGroup}', ['uses' => 'TransactionController@delete', 'as' => 'delete']);
2018-02-16 08:18:07 -06:00
}
);
2019-10-21 11:32:13 -05:00
// special group for transaction journals
Route::group(
2020-03-19 22:42:19 -05:00
['namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'transaction-journals',
'as' => 'api.v1.journals.',],
2019-10-21 11:32:13 -05:00
static function () {
// Transaction API routes:
Route::get('{tj}', ['uses' => 'TransactionController@showByJournal', 'as' => 'showByJournal']);
}
);
2018-02-13 11:24:06 -06:00
Route::group(
2020-03-19 22:42:19 -05:00
['middleware' => ['auth:api', 'bindings', IsAdmin::class], 'namespace' => 'FireflyIII\Api\V1\Controllers', 'prefix' => 'users',
'as' => 'api.v1.users.',],
static function () {
2018-02-13 11:24:06 -06:00
// Users API routes:
Route::get('', ['uses' => 'UserController@index', 'as' => 'index']);
Route::post('', ['uses' => 'UserController@store', 'as' => 'store']);
Route::get('{user}', ['uses' => 'UserController@show', 'as' => 'show']);
Route::put('{user}', ['uses' => 'UserController@update', 'as' => 'update']);
Route::delete('{user}', ['uses' => 'UserController@delete', 'as' => 'delete']);
}
2018-12-31 00:48:23 -06:00
);