Hi,
For some reason I am not able to create invoices using the api
XML I am passing is
“<Invoice_Create xmlns=“http://www.QuickFile.co.uk ” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance ” xsi:schemaLocation=“https://api.quickfile.co.uk https://api.quickfile.co.uk/schemas/1_2/Invoice_Create.xsd ”>
Request[IDSubmittion]43535345345353453534535408gdfgdgdfge-2671-4104-a77a-7f246bf7df2b
INVOICE2449134300BC1300 Business Cards (250gsm)4000VAT20.002010010EMB1Embossing Stamp4000VAT20.0010501
</Invoice_Create>”
Can you please help?
Regars
Well, I am getting an invalid XML message but not understanding where
"<Invoice_Create xmlns=\"https://api.quickfile.co.uk\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"https://api.quickfile.co.uk https://api.quickfile.co.uk/schemas/1_2/Invoice_Create.xsd\">" +
"<Header>" +
"<MessageType>Request</MessageType>" +
"<SubmissionNumber>[IDSubmittion]</SubmissionNumber>" +
"<Authentication>" +
"<AccNumber>" + QuickFile.Settings.accountNo + "</AccNumber>" +
"<MD5Value>[MD5]</MD5Value>" +
"<ApplicationID>" + QuickFile.Settings.appID + "</ApplicationID>" +
"</Authentication>" +
"</Header>" +
"<Body>" +
"<InvoiceData>" +
"<InvoiceType>INVOICE</InvoiceType>" +
"<ClientID>8111759</ClientID>" +
"<ClientAddress>" +
"<Address><![CDATA[123 Test Street<br/>Manchester<br/>MA1 5TH<br/>United Kingdom]]> </Address>" +
"<CountryISO>GB</CountryISO>" +
"</ClientAddress>" +
"<Currency>GBP</Currency>" +
"<TermDays>14</TermDays>" +
"<Language>en</Language>" +
"<InvoiceLines>" +
"<ItemLines>" +
"<ItemLine>" +
"<ItemID>0</ItemID>" +
"<ItemName>BC1</ItemName>" +
"<ItemDescription>300 Business Cards (250gsm)</ItemDescription>" +
"<ItemNominalCode>4000</ItemNominalCode>" +
"<Tax1>" +
"<TaxName>VAT</TaxName>" +
"<TaxPercentage>20.00</TaxPercentage>" +
"<TaxAmount>20</TaxAmount>" +
"</Tax1>" +
"<UnitCost>100</UnitCost>" +
"<Qty>1</Qty>" +
"</ItemLine>" +
"<ItemLine>" +
"<ItemID>0</ItemID>" +
"<ItemName>EMB1</ItemName>" +
"<ItemDescription>Embossing Stamp</ItemDescription>" +
"<ItemNominalCode>4000</ItemNominalCode>" +
"<Tax1>" +
"<TaxName>VAT</TaxName>" +
"<TaxPercentage>20.00</TaxPercentage>" +
"<TaxAmount>10</TaxAmount>" +
"</Tax1>" +
"<UnitCost>50</UnitCost>" +
"<Qty>1</Qty>" +
"</ItemLine>" +
"</ItemLines>" +
"</InvoiceLines>" +
"<Scheduling>" +
"<SingleInvoiceData>" +
"</SingleInvoiceData>" +
"<IssueDate>2017-05-23</IssueDate>" +
"</SingleInvoiceData>" +
"</Scheduling>" +
"</InvoiceData>" +
"</Body>" +
"</Invoice_Create>";
Hi @APereira
I’m not able to test this at the moment, but I did notice you have two closing SingleInvoiceData
tags:
@QFMathew
Not sure why this went there
but still not working, can you please have a quick look?
"<Invoice_Create xmlns = \"https://api.quickfile.co.uk\" xmlns: xsi = \"http://www.w3.org/2001/XMLSchema-instance\" xsi: schemaLocation = \"https://api.quickfile.co.uk https://api.quickfile.co.uk/schemas/1_2/Invoice_Create.xsd\">" +
"<Header>" +
"<MessageType>Request</MessageType>" +
"<SubmissionNumber>[IDSubmittion]</SubmissionNumber>" +
"<Authentication>" +
"<AccNumber>" + QuickFile.Settings.accountNo + "</AccNumber>" +
"<MD5Value>[MD5]</MD5Value>" +
"<ApplicationID>" + QuickFile.Settings.appID + "</ApplicationID>" +
"</Authentication>" +
"</Header>" +
"<Body>" +
"<InvoiceData>" +
"<InvoiceType>INVOICE</InvoiceType>" +
"<ClientID>1263482</ClientID>" +
"<Currency>GBP</Currency>" +
"<TermDays>14</TermDays>" +
"<Language>en</Language>" +
"<InvoiceLines>" +
"<ItemLines>" +
"<ItemLine>" +
"<ItemID>0</ItemID>" +
"<ItemName>BC1</ItemName>" +
"<ItemDescription>300 Business Cards(250gsm)</ItemDescription>" +
"<ItemNominalCode>4000</ItemNominalCode>" +
"<Tax1>" +
"<TaxName>VAT</TaxName>" +
"<TaxPercentage>20.00</TaxPercentage>" +
"<TaxAmount>20</TaxAmount>" +
"</Tax1>" +
"<UnitCost>100</UnitCost>" +
"<Qty>1</Qty>" +
"</ItemLine>" +
"</ItemLines>" +
"</InvoiceLines>" +
"<Scheduling>" +
"<SingleInvoiceData>" +
"<IssueDate>2017-08-17</IssueDate>" +
"</SingleInvoiceData>" +
"</Scheduling>" +
"</InvoiceData>" +
"</Body>" +
"</Invoice_Create>";
Glenn
17 August 2017 11:01
5
It may be the spaces here?
I removed this and saved the output to an XML which appears to be valid.
api-test.xml (1.9 KB)
1 Like
It worked!!!
Thank you very much.
Is there any way of sending it automatically or they always stay as drafts?
Glenn
17 August 2017 11:31
8
Excellent…
Yes you’d need to make a call to invoice_send once you have the unique InvoiceId
back from the create method.
1 Like
Hi Again,
We just noticed that there is no way on the API define the category for an item when creating an invoice from the API.
Is it possible to add the field in?
Regards
Do you mean category as in nominal code, or more of the item name? Or am I thinking of the wrong part?
To save poor old Glen/QFSupport from debugging your scripts, I’d recommend to everybody CodeBeautify where you can validate all sorts of code.
In addition, you can translate one format to another, e.g. XML to JSON, which is where QuickFile is headed, I believe.
Regards, Ian
2 Likes
@QFMathew
Sorry for the late reply.
We always assign a category to each item line on our invoices, is there any way of configuring this when using the API?
Regards
I’m sorry @APereira , I’m not sure I understand what you mean by ‘category’. Do you mean nominal code, or more of the item name, or is there another field you’re using for the category?
For example, where in the web interface would you normally enter this?
Ah right, I’m with you
That’s just the nominal code which matches up with your Chart of Accounts report (under Reports > Chart of Accounts). For example, General Sales is 4000.
This is represented in the API call as the nominal code itself:
<ItemNominalCode>4000</ItemNominalCode>
If it helps, there is also an API call to view a full list of the Chart of Accounts:
https://api.quickfile.co.uk/d/v1_2/Report_ChartOfAccounts/
Oh Awesome.
Just tested and it is working
1 Like