Skip to content

Mtbarros/ynab-api

 
 

Repository files navigation

ynab-api

Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import ynab_api 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import ynab_api

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import ynab_api
from ynab_api.rest import ApiException
from pprint import pprint

# Configure API key authorization: bearer
configuration = ynab_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = ynab_api.AccountsApi(ynab_api.ApiClient(configuration))
budget_id = 'budget_id_example' # str | The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)
account_id = '38400000-8cf0-11bd-b23e-10b96e4ef00d' # str | The id of the account

try:
    # Single account
    api_response = api_instance.get_account_by_id(budget_id, account_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountsApi->get_account_by_id: %s\n" % e)

# Configure API key authorization: bearer
configuration = ynab_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = ynab_api.AccountsApi(ynab_api.ApiClient(configuration))
budget_id = 'budget_id_example' # str | The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.youneedabudget.com/#oauth-default-budget)
last_knowledge_of_server = 789 # int | The starting server knowledge.  If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional)

try:
    # Account list
    api_response = api_instance.get_accounts(budget_id, last_knowledge_of_server=last_knowledge_of_server)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountsApi->get_accounts: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.youneedabudget.com/v1

Class Method HTTP request Description
AccountsApi get_account_by_id GET /budgets/{budget_id}/accounts/{account_id} Single account
AccountsApi get_accounts GET /budgets/{budget_id}/accounts Account list
BudgetsApi get_budget_by_id GET /budgets/{budget_id} Single budget
BudgetsApi get_budget_settings_by_id GET /budgets/{budget_id}/settings Budget Settings
BudgetsApi get_budgets GET /budgets List budgets
CategoriesApi get_categories GET /budgets/{budget_id}/categories List categories
CategoriesApi get_category_by_id GET /budgets/{budget_id}/categories/{category_id} Single category
CategoriesApi get_month_category_by_id GET /budgets/{budget_id}/months/{month}/categories/{category_id} Single category for a specific budget month
CategoriesApi update_month_category PATCH /budgets/{budget_id}/months/{month}/categories/{category_id} Update a category for a specific month
DeprecatedApi bulk_create_transactions POST /budgets/{budget_id}/transactions/bulk Bulk create transactions
MonthsApi get_budget_month GET /budgets/{budget_id}/months/{month} Single budget month
MonthsApi get_budget_months GET /budgets/{budget_id}/months List budget months
PayeeLocationsApi get_payee_location_by_id GET /budgets/{budget_id}/payee_locations/{payee_location_id} Single payee location
PayeeLocationsApi get_payee_locations GET /budgets/{budget_id}/payee_locations List payee locations
PayeeLocationsApi get_payee_locations_by_payee GET /budgets/{budget_id}/payees/{payee_id}/payee_locations List locations for a payee
PayeesApi get_payee_by_id GET /budgets/{budget_id}/payees/{payee_id} Single payee
PayeesApi get_payees GET /budgets/{budget_id}/payees List payees
ScheduledTransactionsApi get_scheduled_transaction_by_id GET /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} Single scheduled transaction
ScheduledTransactionsApi get_scheduled_transactions GET /budgets/{budget_id}/scheduled_transactions List scheduled transactions
TransactionsApi create_transaction POST /budgets/{budget_id}/transactions Create a single transaction or multiple transactions
TransactionsApi get_transaction_by_id GET /budgets/{budget_id}/transactions/{transaction_id} Single transaction
TransactionsApi get_transactions GET /budgets/{budget_id}/transactions List transactions
TransactionsApi get_transactions_by_account GET /budgets/{budget_id}/accounts/{account_id}/transactions List account transactions
TransactionsApi get_transactions_by_category GET /budgets/{budget_id}/categories/{category_id}/transactions List category transactions
TransactionsApi get_transactions_by_payee GET /budgets/{budget_id}/payees/{payee_id}/transactions List payee transactions
TransactionsApi import_transactions POST /budgets/{budget_id}/transactions/import Import transactions
TransactionsApi update_transaction PUT /budgets/{budget_id}/transactions/{transaction_id} Updates an existing transaction
TransactionsApi update_transactions PATCH /budgets/{budget_id}/transactions Update multiple transactions
UserApi get_user GET /user User info

Documentation For Models

Documentation For Authorization

bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

About

Generated Python API for YNAB

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%