Adding Subform data to Books Purchase Order Subform using API

Adding Subform data to Books Purchase Order Subform using API

Hello,
I am trying to add creator forms subforms data to Books purchase Orders Subform but i am not getting any exact format as of how to map the subform data.
This is the code i tried

  1. mapp = Map();
  2. mapp.put("vendor_id","177093000000077066");
  3. mapp.put("purchaseorder_number",input.PO_No);
  4. mapp.put("date",input.PO_Date);
  5. for each rec in Product_Details
  6. {
  7. mapp.put("line_items",[{"name",rec.Item.Product_Name}]);
  8. mapp.put("line_items",[{"quantity",rec.Quantity}]);
  9. mapp.put("line_items",[{"rate",rec.Rate}]);
  10. mapp.put("line_items",[{"tax_treatment_code","uae_same_tax_group"}]);
  11. }
  12. dataa = Map();
  13. dataa.put("JSONString",mapp);
  14. head = Map();
  15. fet_Api = API_Key[ID == 34396000000988943];
  16. head.put("Authorization","Zoho-oauthtoken "+fet_Api.Access_Token);
  17. addRecords = invokeurl
  18. [
  19. url :"https://books.zoho.in/api/v3/purchaseorders?organization_id=60002xxxx"
  20. type :POST
  21. parameters:dataa
  22. headers:head
  23. ];
  24. info addRecords;
This is throwing me the error of Invalid data provided. Please help me its urgent.