Syntax to create Books Package via API?

Syntax to create Books Package via API?

I want to create a Package from an existing Sales Order

I pass to the Packages Create function items_list the output from the Create Sales order. Here is the JSON.


  1. package_data = Map();
  2. package_data.put("package_number","Test");
  3. package_data.put("date","2017-01-11");
  4. item_map = Map();
  5. // item_map.put("so_line_item_id",1234);
  6. item_map.put("quantity",1);
  7. // line_items = list();
  8. // line_items.add(item_map);
  9. package_data.put("line_items",sales_order_data.getJSON("salesorder").getJSON("line_items"));
I get this error: {"code":4,"message":"Invalid value passed for Item ID"}

In the Package I do NOT need all line_item data (ie. custom fields), but I don't understand how to pass the Item ID into the create Package function.

Do I need to iterate through the Sales Order line items to generate a new list of items for the Package with only the parameters it requires?