Create invoice returns "payment_terms_in_days" no matter what

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

Hi Joe,

No problem.

I can see how the docs are confusing - we should improve the examples. We
do try to make it that the request and response are similar so you could
create a resource in the app and then make a GET request via the api to see
the format a request should take.

Kind regards,

GraemeOn 19 July 2012 13:14, Joe Hoyle joehoyle@gmail.com wrote:

Graeme: You are a darn diggedy dang genius!

Thank you very much, this is now working for me too. Looking at the
documentation here:
FreeAgent Developer Dashboard I didn’t say
that. Is the top level “invoice” implicit and it’s just me being stupid or
should this be explicitly mentioned in the docs?

Thanks a million!

Joe

On Thursday, 19 July 2012 13:05:44 UTC+1, Graeme Boyd wrote:

Hi Joe,

Are you missing out the top level invoice key? The following works for
me:

curl https://api.freeagent.com/v2/**invoiceshttps://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/1https://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,

Graeme

On 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 http://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/-/fi4eV4X2UX0Jhttps://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 freeagent_api%2Bunsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/

group/freeagent_api?hl=enhttp://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.
Facebook http://facebook.com/freeagentapp

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774


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/-/4Gu-QVZhNDAJ.

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

This caught me too. You do a great job of showing the response in your docs
but it would be super helpful to show example requests as well. This is
typically the difficult part, not the response.

Currently building a Ruby gem for you guys as well, so that’ll help speed
up development.On Thursday, 19 July 2012 06:51:20 UTC-6, Graeme Boyd wrote:

Hi Joe,

No problem.

I can see how the docs are confusing - we should improve the examples. We
do try to make it that the request and response are similar so you could
create a resource in the app and then make a GET request via the api to see
the format a request should take.

Kind regards,

Graeme

On 19 July 2012 13:14, Joe Hoyle <joeh...@gmail.com <javascript:>> wrote:

Graeme: You are a darn diggedy dang genius!

Thank you very much, this is now working for me too. Looking at the
documentation here:
FreeAgent Developer Dashboard I didn’t say
that. Is the top level “invoice” implicit and it’s just me being stupid or
should this be explicitly mentioned in the docs?

Thanks a million!

Joe

On Thursday, 19 July 2012 13:05:44 UTC+1, Graeme Boyd wrote:

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,

Graeme

On 19 July 2012 12:53, Joe Hoyle <joeh...@gmail.com <javascript:>> 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 freeag...@googlegroups.com
<javascript:>.
To unsubscribe from this group, send email to freeagent_ap…@
googlegroups.com <javascript:>.
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


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/-/4Gu-QVZhNDAJ.

To post to this group, send email to freeag...@googlegroups.com
<javascript:>.
To unsubscribe from this group, send email to
freeagent_ap...@googlegroups.com <javascript:>.
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