We are creating an ecommerce website where several sellers would push their products through an API exposed. Each seller has its own unique identifier for each product (product_id + seller_id) that they send with each request. Hence, they do not rely on "product id" generated by our system to send PUT request after POST.
For each of our client we have to tell to send POST only for already not created stocks, PUT only for already created stocks. Clients need to keep log of all already created stocks and based on that decide which API to hit. On API side too, we send validation error if we get POST for already existing stock OR PUT for non-existing stock.
I want to understand why do we have to keep this complexity on client and server when things could have been simplified if we choose just one of these request that would CREATE/UPDATE according to the situation.
For example if choose only POST. We will create product if request comes and it does not exist OR update it if it is already present.
Why REST suggests to keep POST/PUT separately?