Hi Joe,
Are you missing out the top level invoice key? The following works for me:
curl https://api.freeagent.com/v2/invoices -H “Authorization: Bearer
XXXXXX”
-H “Accept: application/json”
-H “Content-Type: application/json”
-X POST
-d ‘{“invoice”: {
“contact”: “https://api.freeagent.com/v2/contacts/1”,
“dated_on”: “2012-07-02T00:00:00+00:00”,
“due_on”: “2012-08-01T00:00:00+00:00”,
“reference”: “freshbooks-0000482”,
“currency”: “GBP”,
“status”: “Sent”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“description”: “invoice”,
“price”: “3262.50”,
“quantity”: 1
}
]
}
}’
Does that help?
Kind regards,
GraemeOn 19 July 2012 12:53, Joe Hoyle joehoyle@gmail.com wrote:
Hi Everyone,
I am trying to create invoices via the API, and no matter what I do I am
getting the error “payment_terms_in_days” no matter what. My request data
is:{“contact”:“https://api.freeagent.com/v2/contacts/1001840”,“dated_on”:“2012-07-02T00:00:00+00:00”,“due_on”:“2012-08-01T00:00:00+00:00”,“reference”:“freshbooks-0000482”,“currency”:“GBP”,“status”:“Sent”,“payment_terms_in_days”:30,“invoice_items”:[{“description”:“invoice”,“price”:“3262.50”,“quantity”:1}]}
And I get the response:
{“errors”:[{“message”:“payment_terms_in_days is not a number”},{“message”:“base Invoice Date is not valid”}]}
I have tried this locally and in the oAuth 2.0 Playground from Google. Is there a problem on freeagents side? I have tried different numbers, passing the number as a string etc.
Any pointers much appreciated.
Thanks
–
You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/fi4eV4X2UX0J.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.
Graeme Boyd
Senior Software Engineer
Web. freeagent.com http://www.freeagent.com/ Blog. The FreeAgent Blog - FreeAgent
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
FreeAgent | Edinburgh
40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774