2 ms·
fair enough on the single-cart bit. however, when you do PUT, you leave it up to the client to choose the destination id (if it is not already known), this is
by leeoniya 12y ago
fair enough on the single-cart bit.
however, when you do PUT, you leave it up to the client to choose the destination id (if it is not already known), this is not good. You should add items by POSTing to an item factory such as /cart/items. The cart will create the item(s) for you and that item resource will almost certainly hold additional data that was not passed in from the client (usually just SKU + qty) such as base price, calculated discounts, tax, etc. a PUT would not be appropriate as it requires the entire resource to be replaced (or created) at the destination specified by the client. the client rarely knows the entire resource (or has the permission to modify it at will), so follow-up updates should be done via PATCH /cart/items/<iid> or (mass) PATCH /cart/items
http://restcookbook.com/HTTP%20Methods/put-vs-post/ http://restcookbook.com/HTTP%20Methods/put-vs-post/