I’ve been writing some Google Scripts for myself so I can look at my Monzo bank in Alfred (macOS app), it lists all of my pots but when I wanna add money to a pot I get this error:
{“code”:“bad_request.bad_param.amount”,“message”:“must be greater than 0”}
It’s weird because I have definitely added the amount value (my amount) * 100
Any idea what could be wrong? Thanks.
Are you (a) ensuring it’s a float/double before multiplying? Some languages (I’m looking at you, Python) do some funky things; (b) ensuring the result of your multiplation is then an integer before firing off the request?
That’s be where I’d start my debugging, based on description alone.
Have you tried dumping out the payload you’re sending and just looking at the data being sent?
Thanks for your response, but unfortunately it returns the same error when I manually set the value of the amount to 100, which should be 1 GBP , right?
By the way this is what it’s gonna be, I just wanna be able to add or withdraw money from pots when I select one of my pots in Alfred. I think it’s a really cool idea…
That site has had some issues, if you want I can console log my options variable before sending it, I will only censor my auth token…
I have also installed httpie like the documentation says, copy pasted their example only replaced them with my actual values, so Monzo API does work, I only have no idea how I should send my request with google script…
You’ll probably find it far easier to debug by posting to postbin (or similar) and seeing the exact payload you’re sending. Remove your auth token before doing so, if you plan on sharing the output.