Skip to content

Latest commit

 

History

History
259 lines (180 loc) · 9.03 KB

PayeesApi.md

File metadata and controls

259 lines (180 loc) · 9.03 KB

ynab.PayeesApi

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

Method HTTP request Description
get_payee_by_id GET /budgets/{budget_id}/payees/{payee_id} Single payee
get_payees GET /budgets/{budget_id}/payees List payees
update_payee PATCH /budgets/{budget_id}/payees/{payee_id} Update a payee

get_payee_by_id

PayeeResponse get_payee_by_id(budget_id, payee_id)

Single payee

Returns a single payee

Example

  • Bearer Authentication (bearer):
import ynab
from ynab.models.payee_response import PayeeResponse
from ynab.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ynab.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab.Configuration(
    host = "https://api.ynab.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 Bearer authorization: bearer
configuration = ynab.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with ynab.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ynab.PayeesApi(api_client)
    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.ynab.com/#oauth-default-budget).
    payee_id = 'payee_id_example' # str | The id of the payee

    try:
        # Single payee
        api_response = api_instance.get_payee_by_id(budget_id, payee_id)
        print("The response of PayeesApi->get_payee_by_id:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PayeesApi->get_payee_by_id: %s\n" % e)

Parameters

Name Type Description Notes
budget_id 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.ynab.com/#oauth-default-budget).
payee_id str The id of the payee

Return type

PayeeResponse

Authorization

bearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The requested payee -
404 The payee was not found -
0 An error occurred -

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

get_payees

PayeesResponse get_payees(budget_id, last_knowledge_of_server=last_knowledge_of_server)

List payees

Returns all payees

Example

  • Bearer Authentication (bearer):
import ynab
from ynab.models.payees_response import PayeesResponse
from ynab.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ynab.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab.Configuration(
    host = "https://api.ynab.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 Bearer authorization: bearer
configuration = ynab.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with ynab.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ynab.PayeesApi(api_client)
    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.ynab.com/#oauth-default-budget).
    last_knowledge_of_server = 56 # int | The starting server knowledge.  If provided, only entities that have changed since `last_knowledge_of_server` will be included. (optional)

    try:
        # List payees
        api_response = api_instance.get_payees(budget_id, last_knowledge_of_server=last_knowledge_of_server)
        print("The response of PayeesApi->get_payees:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PayeesApi->get_payees: %s\n" % e)

Parameters

Name Type Description Notes
budget_id 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.ynab.com/#oauth-default-budget).
last_knowledge_of_server int The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. [optional]

Return type

PayeesResponse

Authorization

bearer

HTTP request headers

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

HTTP response details

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

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

update_payee

SavePayeeResponse update_payee(budget_id, payee_id, data)

Update a payee

Update a payee

Example

  • Bearer Authentication (bearer):
import ynab
from ynab.models.patch_payee_wrapper import PatchPayeeWrapper
from ynab.models.save_payee_response import SavePayeeResponse
from ynab.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ynab.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = ynab.Configuration(
    host = "https://api.ynab.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 Bearer authorization: bearer
configuration = ynab.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with ynab.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ynab.PayeesApi(api_client)
    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.ynab.com/#oauth-default-budget).
    payee_id = 'payee_id_example' # str | The id of the payee
    data = ynab.PatchPayeeWrapper() # PatchPayeeWrapper | The payee to update

    try:
        # Update a payee
        api_response = api_instance.update_payee(budget_id, payee_id, data)
        print("The response of PayeesApi->update_payee:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PayeesApi->update_payee: %s\n" % e)

Parameters

Name Type Description Notes
budget_id 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.ynab.com/#oauth-default-budget).
payee_id str The id of the payee
data PatchPayeeWrapper The payee to update

Return type

SavePayeeResponse

Authorization

bearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The payee was successfully updated -
400 The request could not be understood due to malformed syntax or validation error(s) -

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