Skip to content

Latest commit

 

History

History
122 lines (88 loc) · 3.43 KB

CategoriesApi.md

File metadata and controls

122 lines (88 loc) · 3.43 KB

CategoriesApi

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

Method HTTP request Description
getCategories GET /budgets/{budget_id}/categories List categories
getCategoryById GET /budgets/{budget_id}/categories/{category_id} Single category

getCategories

CategoriesResponse getCategories(budgetId)

List categories

Returns all categories grouped by category group.

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.CategoriesApi;

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");

CategoriesApi apiInstance = new CategoriesApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
try {
    CategoriesResponse result = apiInstance.getCategories(budgetId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling CategoriesApi#getCategories");
    e.printStackTrace();
}

Parameters

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

Return type

CategoriesResponse

Authorization

bearer

HTTP request headers

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

getCategoryById

CategoryResponse getCategoryById(budgetId, categoryId)

Single category

Returns a single 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.CategoriesApi;

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");

CategoriesApi apiInstance = new CategoriesApi();
UUID budgetId = new UUID(); // UUID | The ID of the Budget.
UUID categoryId = new UUID(); // UUID | The ID of the Category.
try {
    CategoryResponse result = apiInstance.getCategoryById(budgetId, categoryId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling CategoriesApi#getCategoryById");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
budgetId UUID The ID of the Budget.
categoryId UUID The ID of the Category.

Return type

CategoryResponse

Authorization

bearer

HTTP request headers

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