I successfully posted a new sales invoice using api. but I can’t do it for more than one Invoice. When I try to post two Sales invoices I get this message:
{
"Success": false,
"Error": "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Manager.Model.SalesInvoice' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\nPath '', line 1, position 1."
}
Here are my two invoices:
[
{
"IssueDate": "2022-01-16",
"Reference": "2022000050",
"Customer": "fe78e04e-16c8-490b-b235-1ca756dd3846",
"BillingAddress": "جدة - حي الحمرا\nالإدارة المالية - القطاع الغربي\nالرقم الضريبي: 123456789",
"Lines": [
{
"Item": "df8b08e3-1a9d-4336-90a4-b6c35c05a0c6",
"Account": "e1575310-f8e3-4bf8-a72e-0e401bdc7750",
"Description": "212134252",
"CustomFields": {
"415a2f72-bc19-4829-9512-b88c633077d3": "الشركة",
"88fac2a9-9acd-4103-afec-c0b54a393ec9": "<U+202B>فحص واختبار دقة وحدة قياس الطاقة<U+202C>",
"a59bbc90-2fb0-4f87-9d42-82e76a040676": "465",
"0d3bb8f0-cdd0-43f1-ae72-2dead531ebe3": "2021/12/01"
},
"Qty": 300,
"UnitPrice": 127,
"TaxCode": "303938dc-9b3a-4bc3-99e6-dbece8893d7b",
"Project": "df09a515-c1d4-4a55-aaa0-2acdef9eee9b",
"Division": "c51dcc48-94cd-486c-9b0e-5109c3db693c"
}
],
"LineDescription": true,
"DiscountType": "ExactAmount",
"TotalAmountInWords": true,
"TotalAmountInBaseCurrency": true,
"HideDueDate": true,
"HasSalesInvoiceCustomTheme": true,
"SalesInvoiceCustomTheme": "c23482c6-3c8a-4bbb-9c26-dcfe2658d747",
"CustomFields": {
"b8a8dd87-9c60-4ad1-81a3-3f5c82a4d349": "",
"182e7530-9f06-4da5-a683-9503ab4a3647": "",
"f64501d7-55e6-4a6a-b79a-0a4eea96e345": "",
"64f2ae36-fde1-482e-9bc3-6aa03bc92ad5": "",
"a77752fc-db12-44ef-a874-7d37fa10469d": "",
"764659a6-b70a-4e78-9f5d-29c95916bdab": "",
"9daa867b-30d7-4a54-ae1c-1e48e3d29388": "",
"3e0167da-3bd4-4928-8c56-ed88404ba207": "2201000714",
"4b8f6a1c-c4ee-4d43-85b6-d27207a20d74": "4400014765"
}
},
{
"IssueDate": "2022-01-16",
"Reference": "2022000051",
"Customer": "fe78e04e-16c8-490b-b235-1ca756dd3846",
"BillingAddress": "جدة - حي الحمرا\nالإدارة المالية - القطاع الغربي\nالرقم الضريبي: 123456789",
"Lines": [
{
"Item": "df8b08e3-1a9d-4336-90a4-b6c35c05a0c6",
"Account": "e1575310-f8e3-4bf8-a72e-0e401bdc7750",
"Description": "212134252",
"CustomFields": {
"415a2f72-bc19-4829-9512-b88c633077d3": "الشركة",
"88fac2a9-9acd-4103-afec-c0b54a393ec9": "<U+202B>فحص واختبار دقة وحدة قياس الطاقة<U+202C>",
"a59bbc90-2fb0-4f87-9d42-82e76a040676": "465",
"0d3bb8f0-cdd0-43f1-ae72-2dead531ebe3": "2021/12/01"
},
"Qty": 300,
"UnitPrice": 127,
"TaxCode": "303938dc-9b3a-4bc3-99e6-dbece8893d7b",
"Project": "df09a515-c1d4-4a55-aaa0-2acdef9eee9b",
"Division": "c51dcc48-94cd-486c-9b0e-5109c3db693c"
}
],
"LineDescription": true,
"DiscountType": "ExactAmount",
"TotalAmountInWords": true,
"TotalAmountInBaseCurrency": true,
"HideDueDate": true,
"HasSalesInvoiceCustomTheme": true,
"SalesInvoiceCustomTheme": "c23482c6-3c8a-4bbb-9c26-dcfe2658d747",
"CustomFields": {
"b8a8dd87-9c60-4ad1-81a3-3f5c82a4d349": "",
"182e7530-9f06-4da5-a683-9503ab4a3647": "",
"f64501d7-55e6-4a6a-b79a-0a4eea96e345": "",
"64f2ae36-fde1-482e-9bc3-6aa03bc92ad5": "",
"a77752fc-db12-44ef-a874-7d37fa10469d": "",
"764659a6-b70a-4e78-9f5d-29c95916bdab": "",
"9daa867b-30d7-4a54-ae1c-1e48e3d29388": "",
"3e0167da-3bd4-4928-8c56-ed88404ba207": "2201000714",
"4b8f6a1c-c4ee-4d43-85b6-d27207a20d74": "4400014765"
}
}
]
What I’m doing wrong?
How can I post more than one sales invoice, batch creat?