Model For Update DTO

The Model For Update DTO matches in form the Model For Creation DTO. It contains all of the Model properties except the Id.

Lets assume the same Model as used in the Model DTO documentation page.

Class Model
    public guid ModelId
    public string StringProp1
    public int IntProp2
    public datetime DateTimeProp3

The Model For Creation DTO will contain only the properties that are not the automatically generated Id.

{
    "StringProp1":"this is a string",
    "IntProp2":"123",
    "DateTimeProp3":"2019-09-11 1200:00.0000"
}

For update the Model For Update DTO is included in the body of the request, and the Id is included in the URL in a PUT request. The response will contain the same information with an attached Id for confirmation of insertion into the data backend.

You should receive a 204 No Content, implying a successful operation but saving the bandwidth involved in returning data the caller should already have once complete.

A word of warning, inherent in a PUT request, is the request to fully update a model. So, failure to include all of the properties of a model will result in the missing properties being set to null. If you wish to only partially update a model, you should do so via a PATCH request with the usual PATCH request content (see example below). The properties updatable with this request are the same as those shown in the Model For Update DTO. You may also choose to include a collection of ops.

[ {
“op”: “replace”, “path”: “Name”, “value”: “butkis test”
} ]