All Projects → ynab → Ynab Sdk Js

ynab / Ynab Sdk Js

Licence: apache-2.0
YNAB API JavaScript Library

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ynab Sdk Js

Ynab Sdk Ruby
YNAB API Ruby Library
Stars: ✭ 54 (-67.66%)
Mutual labels:  api, rest-api, finance
Poloniex Api Node
Poloniex API client for REST and WebSocket API
Stars: ✭ 138 (-17.37%)
Mutual labels:  api, rest-api
Fastify Api
A blazing fast REST APIs with Node.js, MongoDB, Fastify and Swagger.
Stars: ✭ 138 (-17.37%)
Mutual labels:  api, rest-api
Api Guidelines
adidas group API design guidelines
Stars: ✭ 147 (-11.98%)
Mutual labels:  api, rest-api
Fipe
Tabela Fipe API 🚗💰 http://deividfortuna.github.io/fipe
Stars: ✭ 123 (-26.35%)
Mutual labels:  api, rest-api
Open Rest
Standard rest server, Base on restify and sequelize
Stars: ✭ 136 (-18.56%)
Mutual labels:  api, rest-api
Node Express Mongoose Passport Jwt Rest Api Auth
Node, express, mongoose, passport and JWT REST API authentication example
Stars: ✭ 146 (-12.57%)
Mutual labels:  api, rest-api
Laravel Hateoas
Expose the authorization logic of your REST API using HATEOAS links
Stars: ✭ 116 (-30.54%)
Mutual labels:  api, rest-api
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-8.98%)
Mutual labels:  api, rest-api
Restful Api With Laravel Definitive Guide
Repository with the base code for the course "RESTful API with Laravel - Definitive-Guide"
Stars: ✭ 156 (-6.59%)
Mutual labels:  api, rest-api
Bmw Tensorflow Inference Api Cpu
This is a repository for an object detection inference API using the Tensorflow framework.
Stars: ✭ 158 (-5.39%)
Mutual labels:  api, rest-api
30 Days Of Python
Learn Python for the next 30 (or so) Days.
Stars: ✭ 1,748 (+946.71%)
Mutual labels:  api, rest-api
Rest Api Fuzz Testing
REST API Fuzz Testing (RAFT): Source code for self-hosted service developed for Azure, including the API, orchestration engine, and default set of security tools (including MSR's RESTler), that enables developers to embed security tooling into their CI/CD workflows
Stars: ✭ 119 (-28.74%)
Mutual labels:  api, rest-api
React With Wordpress
🔥 Example of react application to access WordPress REST API
Stars: ✭ 137 (-17.96%)
Mutual labels:  api, rest-api
Coronavirus Tracker Api
🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
Stars: ✭ 1,577 (+844.31%)
Mutual labels:  api, rest-api
Grafanajsondatasource
Grafana datasource to load JSON data over your arbitrary HTTP backend
Stars: ✭ 146 (-12.57%)
Mutual labels:  api, rest-api
Jda
Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Stars: ✭ 2,598 (+1455.69%)
Mutual labels:  api, rest-api
Laravel Api Boilerplate
A Boilerplate Project For Laravel API's (NOT MAINTAINED)
Stars: ✭ 113 (-32.34%)
Mutual labels:  api, rest-api
Degiroapi
An unofficial API for the trading platform Degiro, with the ability to get real time data and historical data
Stars: ✭ 114 (-31.74%)
Mutual labels:  api, finance
Laravel Api Handler
Package providing helper functions for a Laravel REST-API
Stars: ✭ 150 (-10.18%)
Mutual labels:  api, rest-api

YNAB API JavaScript Library

Build Status npm version

Please read the YNAB API documentation for an overview of using the API and a complete list of available resources.

This client is generated using the Swagger Code Generator.

Installation

First, install the module with npm (or yarn):

npm install ynab

Then, depending upon your usage context, add a reference to it:

CommonJS / Node

const ynab = require("ynab");

ESM / TypeScript

import * as ynab from "ynab";

Browser

The API supports Cross Origin Resource Sharing (CORS) for asynchronous browser requests from any origin.

The dist/browser/ynab.js file (located in node_modules/ynab after installation) is specifically built to run in a browser / window context and exports ynab variable to global namespace. No other dependencies are needed.

<script src="ynab.js" async></script>
...
<script>
  // This assignment is not necessary but demonstrates that
  // once the library is loaded, the global 'ynab' object will be available.
  var ynab = window.ynab;
</script>

CDN

A simple way to load the library in a browser is by using the unpkg CDN, which is a "fast, global content delivery network for everything on npm". To use it, include a script tag like this in your file:

<script src="https://unpkg.com/[email protected]/dist/browser/ynab.js" async></script>

Using the "latest" tag will result in a 302 redirect to the latest version tag so it is highly recommended to use a specific version tag such as https://unpkg.com/[email protected]/dist/browser/ynab.js to avoid this redirect.

Usage

To use this client, you must obtain an access token from the Account Settings area of the YNAB web application.

const accessToken = "b43439eaafe2_this_is_fake_b43439eaafe2";
const ynabAPI = new ynab.API(accessToken);

(async function() {
  const budgetsResponse = await ynabAPI.budgets.getBudgets();
  const budgets = budgetsResponse.data.budgets;
  for (let budget of budgets) {
    console.log(`Budget Name: ${budget.name}`);
  }
})();

Error Handling

If a response is returned with a code >= 300, instead of returning the response, the response will be thrown as an error to be caught.

const ynab = require("ynab");
const accessToken = "invalid_token";
const ynabAPI = new ynab.API(accessToken);

const budgetsResponse = ynabAPI.budgets
  .getBudgets()
  .then(budgetsResponse => {
    // Won't get here because an error will be thrown
  })
  .catch(e => {
    console.log(e);
    // {
    //   error: {
    //    id: "401",
    //    name: "unauthorized",
    //    detail: "Unauthorized"
    //   }
    // }
  });

Examples

See the examples folder for example usage scenarios.

Methods

The following methods are available in this library. For more details on parameters and usage, the TypeScript declaration file can be referenced.

Method Description
User user.getUser() Returns authenticated user information
Budgets budgets.getBudgets() Returns budgets list with summary information
budgets.getBudgetById(budget_id) Returns a single budget with all related entities
budgets.getBudgetSettingsById(budget_id) Returns settings for a budget
Accounts accounts.getAccounts(budget_id) Returns all accounts
accounts.getAccountById(budget_id, account_id) Returns a single account
Categories categories.getCategories(budget_id) Returns all categories grouped by category group.
categories.getCategoryById(budget_id, category_id) Returns a single category
categories.updateMonthCategory(budget_id, month, category_id, month_category) Update an existing month category
Payees payees.getPayees(budget_id) Returns all payees
payees.getPayeeById(budget_id, payee_id) Returns single payee
Payee Locations payee_locations.getPayeeLocations(budget_id) Returns all payee locations
payee_locations.getPayeeLocationById(budget_id, payee_location_id) Returns a single payee location
payee_locations.getPayeeLocationsByPayee(budget_id, payee_id) Returns all payee locations for the specified payee
Months months.getBudgetMonths(budget_id) Returns all budget months
months.getBudgetMonth(budget_id, month) Returns a single budget month
months.getMonthCategory_by_id(budget_id, month, category_id) Returns a single category for a specific budget month
Transactions transactions.getTransactions(budget_id) Returns budget transactions
transactions.getTransactionsByAccount(budget_id, account_id) Returns all transactions for a specified account
transactions.getTransactionsByCategory(budget_id, category_id) Returns all transactions for a specified category
transactions.getTransactionById(budget_id, transaction_id) Returns a single transaction
transactions.createTransaction(budget_id, data) Creates a single transaction
transactions.createTransactions(budget_id, data) Creates multiple transactions
transactions.updateTransaction(budget_id, transaction_id, data) Updates a single transaction
transactions.updateTransactions(budget_id, data) Updates multiple transactions
transactions.importTransactions(budget_id) Imports transactions
Scheduled Transactions scheduled_transactions.getScheduledTransactions(budget_id) Returns all scheduled transactions
scheduled_transactions.getScheduledTransactionById(budget_id, scheduled_transaction_id) Returns a single scheduled transaction

Utilities

There are several utilities available on the utils export to make working with ISO dates and milliunits a bit easier.

// Returns the current month (system timezone) in ISO 8601 format (i.e. '2015-12-01')
utils.getCurrentMonthInISOFormat(): string;
// Returns the current date (system timezone) in ISO 8601 format (i.e. '2015-12-15')
utils.getCurrentDateInISOFormat(): string;
// Converts an ISO 8601 formatted string to a JS date object
utils.convertFromISODateString(isoDateString: string): Date;
// Converts a milliunits amount to a currency amount
utils.convertMilliUnitsToCurrencyAmount(milliunits: number, currencyDecimalDigits: number): number;

License

Copyright (c) 2018 You Need A Budget, LLC

Licensed under the Apache-2.0 license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].