
API request to create account with type 'otherAsset' changes type to 'other Asset'
I'm working on a script that will create some tracking accounts, and I discovered what looks like a bug in the create account endpoint (i.e. POST to /budgets/{budget_id}/accounts). A tracking account created from the UI has type "otherAsset", when I send a request to create an account with type "otherAsset", it is changed to "other Asset". The UI seems to handle this without any trouble, but it causes problems with generated API clients since "other Asset" is not an allowed value.
This sequence of curl requests demonstrates the issue. Note the account "Test" was created in the UI, then I create an account called "Test API".
❯ curl -X GET "https://api.youneedabudget.com/v1/budgets/<budget id>/accounts" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $(cat ynab_token)" | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 299 0 299 0 0 339 0 --:--:-- --:--:-- --:--:-- 339 { "data": { "accounts": [ { "id": "<redacted>", "name": "Test", "type": "otherAsset", "on_budget": false, "closed": false, "note": null, "balance": 0, "cleared_balance": 0, "uncleared_balance": 0, "transfer_payee_id": "<redacted>", "deleted": false } ], "server_knowledge": 68 } } ❯ curl -X POST "https://api.youneedabudget.com/v1/budgets/<budget id>/accounts" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $(cat ynab_token)" -d "{ \"account\": { \"name\": \"Test API\", \"type\": \"otherAsset\", \"balance\": 0 }}" | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 384 0 301 100 83 451 124 --:--:-- --:--:-- --:--:-- 575 { "data": { "account": { "id": "<redacted>", "name": "Test API", "type": "other Asset", "on_budget": false, "closed": false, "note": null, "balance": 0, "cleared_balance": 0, "uncleared_balance": 0, "transfer_payee_id": "<redacted>", "deleted": false }, "server_knowledge": 70 } } ❯ curl -X GET "https://api.youneedabudget.com/v1/budgets/<budget id>/accounts" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $(cat ynab_token)" | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 558 0 558 0 0 1143 0 --:--:-- --:--:-- --:--:-- 1143 { "data": { "accounts": [ { "id": "<redacted>", "name": "Test", "type": "otherAsset", "on_budget": false, "closed": false, "note": null, "balance": 0, "cleared_balance": 0, "uncleared_balance": 0, "transfer_payee_id": "<redacted>", "deleted": false }, { "id": "<redacted>", "name": "Test API", "type": "other Asset", "on_budget": false, "closed": false, "note": null, "balance": 0, "cleared_balance": 0, "uncleared_balance": 0, "transfer_payee_id": "<redacted>", "deleted": false } ], "server_knowledge": 70 } }