Skip to content

Latest commit

 

History

History
185 lines (132 loc) · 7.25 KB

MonthsApi.md

File metadata and controls

185 lines (132 loc) · 7.25 KB

ynab_api.MonthsApi

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

Method HTTP request Description
get_budget_month GET /budgets/{budget_id}/months/{month} Single budget month
get_budget_months GET /budgets/{budget_id}/months List budget months

get_budget_month

MonthDetailResponse get_budget_month(budget_id, month)

Single budget month

Returns a single budget month

Example

  • Api Key Authentication (bearer):
import time
import ynab_api
from ynab_api.api import months_api
from ynab_api.model.error_response import ErrorResponse
from ynab_api.model.month_detail_response import MonthDetailResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.youneedabudget.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab_api.Configuration(
    host = "https://api.youneedabudget.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: bearer
configuration.api_key['bearer'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['bearer'] = 'Bearer'

# Enter a context with an instance of the API client
with ynab_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = months_api.MonthsApi(api_client)
    budget_id = "budget_id_example" # str, none_type | 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).
    month = dateutil_parser('1970-01-01').date() # date, none_type | The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC))

    # example passing only required values which don't have defaults set
    try:
        # Single budget month
        api_response = api_instance.get_budget_month(budget_id, month)
        pprint(api_response)
    except ynab_api.ApiException as e:
        print("Exception when calling MonthsApi->get_budget_month: %s\n" % e)

Parameters

Name Type Description Notes
budget_id str, none_type 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).
month date, none_type The budget month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))

Return type

MonthDetailResponse

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The budget month detail -
404 The budget month was not found -
0 An error occurred -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_budget_months

MonthSummariesResponse get_budget_months(budget_id)

List budget months

Returns all budget months

Example

  • Api Key Authentication (bearer):
import time
import ynab_api
from ynab_api.api import months_api
from ynab_api.model.month_summaries_response import MonthSummariesResponse
from ynab_api.model.error_response import ErrorResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.youneedabudget.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab_api.Configuration(
    host = "https://api.youneedabudget.com/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: bearer
configuration.api_key['bearer'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['bearer'] = 'Bearer'

# Enter a context with an instance of the API client
with ynab_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = months_api.MonthsApi(api_client)
    budget_id = "budget_id_example" # str, none_type | 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 = 1 # int, none_type | The starting server knowledge.  If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional)

    # example passing only required values which don't have defaults set
    try:
        # List budget months
        api_response = api_instance.get_budget_months(budget_id)
        pprint(api_response)
    except ynab_api.ApiException as e:
        print("Exception when calling MonthsApi->get_budget_months: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # List budget months
        api_response = api_instance.get_budget_months(budget_id, last_knowledge_of_server=last_knowledge_of_server)
        pprint(api_response)
    except ynab_api.ApiException as e:
        print("Exception when calling MonthsApi->get_budget_months: %s\n" % e)

Parameters

Name Type Description Notes
budget_id str, none_type 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 int, none_type The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. [optional]

Return type

MonthSummariesResponse

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The list of budget months -
404 No budget months were found -
0 An error occurred -

[Back to top] [Back to API list] [Back to Model list] [Back to README]