Creating an invoice with CURL - Example XML for an invoice including Amount and VAT rate
Hi,
I have recently joined the trial program and am trying to create a very simple invoice using CURL.The only requirement is for the invoice XML to contain invoice date, invoice amount, vat rate, client, and project.
However, the server is not accepting the simple XML I am sending. The XML I am sending on the CURL command is:
-- pretty printed here for easy of viewing
<invoice>
<company-id type="integer">3049</company-id>
<project-id type="integer">14651</project-id>
<contact-id type="integer">20769</contact-id>
<dated-on type="datetime">2009-06-28T00:00:00Z</dated-on>
<due-on type="datetime">2009-07-28T00:00:00Z</due-on>
<reference>8949</reference>
<net-value type="decimal">100.0</net-value>
<sales-tax-value type="decimal">15.0</sales-tax-value>
<status>Draft</status>
<comments>kjk</comments>
<payment-terms-in-days type="integer">30</payment-terms-in-days>
</invoice>
and the error I get from the server is:
<html><body><h1>500 Internal Server Error</h1>If you are the administrator of th
is website, then please read this web application's log file to find out what went wrong.</body></html>
Any ideas on what could be the problem ?
Could you please send us an example XML that we could pass into CURL to create a really simple invoice that includes Amount and VAT rate ?
Thank you !
Jos
I have recently joined the trial program and am trying to create a very simple invoice using CURL.The only requirement is for the invoice XML to contain invoice date, invoice amount, vat rate, client, and project.
However, the server is not accepting the simple XML I am sending. The XML I am sending on the CURL command is:
-- pretty printed here for easy of viewing
<invoice>
<company-id type="integer">3049</company-id>
<project-id type="integer">14651</project-id>
<contact-id type="integer">20769</contact-id>
<dated-on type="datetime">2009-06-28T00:00:00Z</dated-on>
<due-on type="datetime">2009-07-28T00:00:00Z</due-on>
<reference>8949</reference>
<net-value type="decimal">100.0</net-value>
<sales-tax-value type="decimal">15.0</sales-tax-value>
<status>Draft</status>
<comments>kjk</comments>
<payment-terms-in-days type="integer">30</payment-terms-in-days>
</invoice>
and the error I get from the server is:
<html><body><h1>500 Internal Server Error</h1>If you are the administrator of th
is website, then please read this web application's log file to find out what went wrong.</body></html>
Any ideas on what could be the problem ?
Could you please send us an example XML that we could pass into CURL to create a really simple invoice that includes Amount and VAT rate ?
Thank you !
Jos
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
The best answer from the company
-
Hi Jos
It looks like you're supplying some parameters which are not necessary, specifically: due-on, net-value, sales-tax-value.
The net value and sales tax values of an invoice are inferred from it's invoice items. Similarly, the due date is inferred from the invoice date and the payment terms in days.
So, the basic XML you'll need to supply to create an invoice is:
<invoice>
<company-id>42</company-id>
<project-id>21</project-id>
<dated-on>2008-02-17T00:00:00Z</dated-on>
<reference>INVOICE 2001</reference>
<status>Draft</status>
<comments>A comment</comments>
</invoice>
Check out our API guide for more detailed info.
I’m happy
The company says
this answers the question
-
Inappropriate?Hi Jos
It looks like you're supplying some parameters which are not necessary, specifically: due-on, net-value, sales-tax-value.
The net value and sales tax values of an invoice are inferred from it's invoice items. Similarly, the due date is inferred from the invoice date and the payment terms in days.
So, the basic XML you'll need to supply to create an invoice is:
<invoice>
<company-id>42</company-id>
<project-id>21</project-id>
<dated-on>2008-02-17T00:00:00Z</dated-on>
<reference>INVOICE 2001</reference>
<status>Draft</status>
<comments>A comment</comments>
</invoice>
Check out our API guide for more detailed info.
I’m happy
The company says
this answers the question
-
This reply was removed on 06/29/09.
see the change log -
Inappropriate?Thanks for the quick reply Olly,
The basic XML in your reply does not include invoice amount and VAT.
Could you please provide an example XML for a simple invoice that includes net amount and VAT.
Thank you !
I’m happy
-
Inappropriate?Hi Jos
Once you've created an invoice using the example above (ie. without net amount and VAT) you can then create invoice items to the values you require. The invoice will then appear in FreeAgent with corresponding net amount and VAT:
http://www.freeagentcentral.com/devel...
Let me know if this works for you. -
Inappropriate?Thank you Olly,
I guess your approach will require a few curl requests... as separetely creating the invoice item will then require to retrieve and then pass back the invoice id of an invoice previously created, etc.
is it not possible to create the invoice including its invoice item in one go ie. in a single curl request using a single XML which includes the core invoice AND its invoice item ?
Thanks !
I’m happy
-
Inappropriate?Hi Jos
is it not possible to create the invoice including its invoice item in one go ie. in a single curl request using a single XML which includes the core invoice AND its invoice item ?
This isn't possible at the present time but it's definitely something we'd consider adding when time permits.
Loading Profile...



