Error generating journal from custom function

Error generating journal from custom function

Good day,
I am trying to generate a journal from a custom function but it returns the following error:

{"code":11,"message":"Solicitar carga útil no debe estar vacía para la solicitud."}

Reviewing the documentation of the books apis, I am considering all the fields even if they are not required, then I leave my code in deluge with the call to the api that returns the error:

for each  invoiceline in invoice.get("line_items")
{
MapaDiario = Map();
MapaDiarioLine = Map();
MapaDiarioLine1 = Map();
MapaDiarioTag = Map();
MapaDiarioTag1 = Map();
MapaDiarioCF = Map();
ListDiario = List();
if(invoiceline.get("project_id") != null && invoiceline.get("project_id") != "" && invoiceline.get("project_id") != "null")
{
MapaDiario.put("customer_id","1932335000007555077");
ResProj = zoho.books.getRecordsByID("Projects",organization.get("organization_id"),invoiceline.get("project_id"),"test_ih");
MapaDiario.put("reference_number",ResProj.get("project").get("customer_name") + " " + invoice.get("invoice_number"));
MapaDiario.put("notes",ResProj.get("project").get("customer_name") + " " + invoice.get("invoice_number"));
MapaDiario.put("journal_type","Both");
MapaDiario.put("currency_id",invoice.get("currency_id"));
MapaDiario.put("exchange_rate",invoice.get("exchange_rate"));
//Línea de diario para débito:
MapaDiarioLine.put("account_id","1932335000000034004");
MapaDiarioLine.put("customer_id",ResProj.get("project").get("customer_id"));
MapaDiarioLine.put("description",ResProj.get("project").get("customer_name") + " " + invoice.get("invoice_number"));
MapaDiarioLine.put("amount",invoiceline.get("item_total"));
MapaDiarioLine.put("debit_or_credit","debit");
MapaDiarioLine.put("project_id",ResProj.get("project").get("project_id"));
MapaDiarioTag.put("tag_id","");
MapaDiarioTag.put("tag_option_id","");
MapaDiarioLine.put("tags",MapaDiarioTag);
ListDiario.add(MapaDiarioLine);
//Línea de diario para crédito:
MapaDiarioLine1.put("account_id","1932335000000034004");
MapaDiarioLine1.put("customer_id",ResProj.get("project").get("customer_id"));
MapaDiarioLine1.put("description",ResProj.get("project").get("customer_name") + " " + invoice.get("invoice_number"));
MapaDiarioLine1.put("amount",invoiceline.get("item_total"));
MapaDiarioLine1.put("debit_or_credit","credit");
MapaDiarioLine1.put("project_id",ResProj.get("project").get("project_id"));
MapaDiarioTag1.put("tag_id","");
MapaDiarioTag1.put("tag_option_id","");
MapaDiarioLine1.put("tags",MapaDiarioTag1);
ListDiario.add(MapaDiarioLine1);
MapaDiario.put("line_items",ListDiario);
MapaDiario.put("status","draft");
MapaDiarioCF.put("customfield_id","");
MapaDiarioCF.put("value","");
MapaDiario.put("custom_fields",MapaDiarioCF);
info "Mapa: " + MapaDiario;
}
}
RespDiario = zoho.books.createRecord("journals",organization.get("organization_id"),MapaDiario,"test_ih");
info "Resp: " + RespDiario;

In the code infos I get the Map that I send in the api, which I see is well structured:

Mapa: {"customer_id":"1932335000007555077","reference_number":"Sz Test Account SA de CV TEST TI","notes":"Sz Test Account SA de CV TEST TI","journal_type":"Both","currency_id":"1932335000000068065","exchange_rate":"1.0","line_items":[{"account_id":"1932335000000034004","customer_id":"1932335000007555077","description":"Sz Test Account SA de CV TEST TI","amount":1,"debit_or_credit":"debit","project_id":"1932335000015786693","tags":{"tag_id":"","tag_option_id":""}},{"account_id":"1932335000000034004","customer_id":"1932335000007555077","description":"Sz Test Account SA de CV TEST TI","amount":1,"debit_or_credit":"credit","project_id":"1932335000015786693","tags":{"tag_id":"","tag_option_id":""}}],"status":"draft","custom_fields":{"customfield_id":"","value":""}}

Could someone help me see what the error is, thank you very much in advance.

Greetings.



          Zoho TeamInbox Resources

            Zoho DataPrep Resources


                Zoho CRM Plus Resources

                  Zoho Books Resources


                    Zoho Subscriptions Resources

                      Zoho Desk Resources

                        Zoho Projects Resources


                          Zoho Sprints Resources


                            Zoho Orchestly Resources


                              Zoho Creator Resources


                                Zoho WorkDrive Resources




                                    Zoho Campaigns Resources

                                      Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方