Skip to content

Latest commit

 

History

History
482 lines (358 loc) · 15.9 KB

TransactionsApi.md

File metadata and controls

482 lines (358 loc) · 15.9 KB

TransactionsApi

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

Method HTTP request Description
bulkCreateTransactions POST /budgets/{budget_id}/transactions/bulk Bulk create transactions
createTransaction POST /budgets/{budget_id}/transactions Create new transaction
getTransactions GET /budgets/{budget_id}/transactions List transactions
getTransactionsByAccount GET /budgets/{budget_id}/accounts/{account_id}/transactions List account transactions
getTransactionsByCategory GET /budgets/{budget_id}/categories/{category_id}/transactions List category transactions
getTransactionsById GET /budgets/{budget_id}/transactions/{transaction_id} Single transaction
getTransactionsByPayee GET /budgets/{budget_id}/payees/{payee_id}/transactions List payee transactions
updateTransaction PUT /budgets/{budget_id}/transactions/{transaction_id} Updates an existing transaction

bulkCreateTransactions

BulkResponse bulkCreateTransactions(budgetId, transactions)

Bulk create transactions

Creates multiple transactions

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
BulkTransactions transactions = new BulkTransactions(); // BulkTransactions | The list of Transactions to create.
try {
    BulkResponse result = apiInstance.bulkCreateTransactions(budgetId, transactions);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#bulkCreateTransactions");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
transactions BulkTransactions The list of Transactions to create.

Return type

BulkResponse

Authorization

bearer

HTTP request headers

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

createTransaction

TransactionResponse createTransaction(budgetId, transaction)

Create new transaction

Creates a transaction

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
SaveTransactionWrapper transaction = new SaveTransactionWrapper(); // SaveTransactionWrapper | The Transaction to create.
try {
    TransactionResponse result = apiInstance.createTransaction(budgetId, transaction);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#createTransaction");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
transaction SaveTransactionWrapper The Transaction to create.

Return type

TransactionResponse

Authorization

bearer

HTTP request headers

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

getTransactions

TransactionsResponse getTransactions(budgetId, sinceDate, type)

List transactions

Returns budget transactions

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
LocalDate sinceDate = new LocalDate(); // LocalDate | Only return transactions on or after this date.
String type = "type_example"; // String | Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved')
try {
    TransactionsResponse result = apiInstance.getTransactions(budgetId, sinceDate, type);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#getTransactions");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
sinceDate LocalDate Only return transactions on or after this date. [optional]
type String Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') [optional] [enum: uncategorized, unapproved]

Return type

TransactionsResponse

Authorization

bearer

HTTP request headers

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

getTransactionsByAccount

TransactionsResponse getTransactionsByAccount(budgetId, accountId, sinceDate)

List account transactions

Returns all transactions for a specified account

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID accountId = new UUID(); // UUID | The ID of the Account.
LocalDate sinceDate = new LocalDate(); // LocalDate | Only return transactions on or after this date.
try {
    TransactionsResponse result = apiInstance.getTransactionsByAccount(budgetId, accountId, sinceDate);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#getTransactionsByAccount");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
accountId UUID The ID of the Account.
sinceDate LocalDate Only return transactions on or after this date. [optional]

Return type

TransactionsResponse

Authorization

bearer

HTTP request headers

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

getTransactionsByCategory

HybridTransactionsResponse getTransactionsByCategory(budgetId, categoryId, sinceDate)

List category transactions

Returns all transactions for a specified category

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID categoryId = new UUID(); // UUID | The ID of the Category.
LocalDate sinceDate = new LocalDate(); // LocalDate | Only return transactions on or after this date.
try {
    HybridTransactionsResponse result = apiInstance.getTransactionsByCategory(budgetId, categoryId, sinceDate);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#getTransactionsByCategory");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
categoryId UUID The ID of the Category.
sinceDate LocalDate Only return transactions on or after this date. [optional]

Return type

HybridTransactionsResponse

Authorization

bearer

HTTP request headers

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

getTransactionsById

TransactionResponse getTransactionsById(budgetId, transactionId)

Single transaction

Returns a single transaction

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID transactionId = new UUID(); // UUID | The ID of the Transaction.
try {
    TransactionResponse result = apiInstance.getTransactionsById(budgetId, transactionId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#getTransactionsById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
transactionId UUID The ID of the Transaction.

Return type

TransactionResponse

Authorization

bearer

HTTP request headers

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

getTransactionsByPayee

HybridTransactionsResponse getTransactionsByPayee(budgetId, payeeId, sinceDate)

List payee transactions

Returns all transactions for a specified payee

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID payeeId = new UUID(); // UUID | The ID of the Payee.
LocalDate sinceDate = new LocalDate(); // LocalDate | Only return transactions on or after this date.
try {
    HybridTransactionsResponse result = apiInstance.getTransactionsByPayee(budgetId, payeeId, sinceDate);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#getTransactionsByPayee");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
payeeId UUID The ID of the Payee.
sinceDate LocalDate Only return transactions on or after this date. [optional]

Return type

HybridTransactionsResponse

Authorization

bearer

HTTP request headers

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

updateTransaction

TransactionResponse updateTransaction(budgetId, transactionId, transaction)

Updates an existing transaction

Updates a transaction

Example

// Import classes:
//import ynab.client.invoker.ApiClient;
//import ynab.client.invoker.ApiException;
//import ynab.client.invoker.Configuration;
//import ynab.client.invoker.auth.*;
//import ynab.client.api.TransactionsApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");

TransactionsApi apiInstance = new TransactionsApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID transactionId = new UUID(); // UUID | The ID of the Transaction.
SaveTransactionWrapper transaction = new SaveTransactionWrapper(); // SaveTransactionWrapper | The Transaction to update.
try {
    TransactionResponse result = apiInstance.updateTransaction(budgetId, transactionId, transaction);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TransactionsApi#updateTransaction");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
transactionId UUID The ID of the Transaction.
transaction SaveTransactionWrapper The Transaction to update.

Return type

TransactionResponse

Authorization

bearer

HTTP request headers

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