Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YNAB::SaveTransaction amount = Integer instead of Float? #22

Closed
therod opened this issue Jul 12, 2018 · 2 comments
Closed

YNAB::SaveTransaction amount = Integer instead of Float? #22

therod opened this issue Jul 12, 2018 · 2 comments

Comments

@therod
Copy link

therod commented Jul 12, 2018

Hey there!

The Documentation specifies that the amount parameter should be a float. If I provide a float in my request I get a YNAB::ApiError: Bad Request error which I found strange.

Upon further investigation and playing with the API over at api.youneedabudget.com it seems that the API requires an Integer not a Float.

{
  "error": {
    "id": "400",
    "name": "bad_request",
    "detail": "{\"amount\":[\"must be an integer\"],\"date\":[\"must be an ISO formatted date\"]}"
  }
}

I'm currently writing an integration for a Swiss bank – but only being able to write Integers via the API would be a major letdown. 😔

Thanks for your time.

Best,
Rodrigo

@bradymholt
Copy link
Member

@therod The API only allows integers but we use a format called milliunits which allows you to specify a decimal value. For example, to specify 11.32 you would use 11320. The docs on the client repo here should not be showing Float and we'll get that fixed. Thank you.

@therod
Copy link
Author

therod commented Jul 13, 2018

Got it! Thanks for clearing this up @bradymholt 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants