Is it possible to make the same field compulsory for POST and optional for PUT requests for REST API? Or it depends on teqnology used to implement this request?
For example, there is a POST request to create Car
objects and this object has a field model_id
which is actually chosen from a dictionary of models. And the POST request requires model_id
because the car must have model_id defined.
And I want to have a PUT method which changes some field e.g. serial_num
, manufacture_date
, color
etc. even model_id
. But I want this PUT method to change model_id
as optional parameter, e.g. I just want to change color and it is Ok.
So is this possible in REST? Does some technologies that implement these request could not allow me to make different set of optional/compulsory params for POST ant PUT?