Shipment Api Working Intermittently?

I'm using the following PHP code:

$params = array(
'carrier' => $carrier,
'order_id' => $order_id,
'shipping_id' => $row_order['shipping_ids'],
'products' => $product_array,
'tracking_number' => $tracking_number,
'comments' => $comments
);
$shipment = $cscartapi->create("shipments/", $params);
Example $params is:
(
[carrier] => usps
[order_id] => 133678
[shipping_id] => 8
[products] => Array
(
[2115529782] => 1
)
[tracking_number] => XXXXXX361037XXX
[comments] =>
)
The problem is most of the time when the shipment is created the product is not added to the shipment in cs-cart. Interestingly, if I delete the shipment and run the same script again, the product is added to the new shipment. Why intermittent the first time? Same script.
David

OK, I resolved it. I blame it on poor cs-cart documentation. The documentation at http://docs.cs-cart.com/4.6.x/developer_guide/api/entities/shipments.html lists the products field as Mandatory. It is NOT. If you leave off the field, cs-cart will automatically fill in the correct products for that order#. Actually most of the fields listed on that page marked as Mandatory are NOT. I wish cs-cart would update their documentation with correct data.

OK, I resolved it. I blame it on poor cs-cart documentation. The documentation at http://docs.cs-cart.com/4.6.x/developer_guide/api/entities/shipments.html lists the products field as Mandatory. It is NOT. If you leave off the field, cs-cart will automatically fill in the correct products for that order#. Actually most of the fields listed on that page marked as Mandatory are NOT. I wish cs-cart would update their documentation with correct data.


Hello, David. I'm sorry to hear that you experienced problems because of the lack of info in the documentation. The article about shipments hasn't been rewritten yet in accordance with our latest standards (a rewritten article would look like the article about orders or product variations). Among other improvements, articles in the new format have separate lists of required fields for POST and PUT requests, so it should help with the problem you described.

We do have plans to eventually rewrite all articles about REST API entities in this format, but I can't say yet how soon it will happen, because there are other documentation-related tasks with higher priority right now. But those priorities aren't set in stone; that's why I'd like to thank you for bringing up this topic.