Want to understand good practice to design REST API
If a resource needs to be update partially, which is better? PUT or PATCH
Please advice if my understanding is correct
POST - to persist Customer with 2 address
{"custId":"1", "name":"Rocky",
"address":[{"id":"1","zip":"1234"},
{"id":"2","zip":"12345"}]
}
Now to update zip code for address id 1
PUT - full JSON is a requirement to be sent to REST API ?
{"custId":"1", "name":"Rocky",
"address":[{"id":"1","zip":"9876"},
{"id":"2","zip":"12345"}]
}
PATCH - partial (or full) JSON can be sent to REST API ?
{"custId":"1", "name":"Rocky",
"address":[{"id":"1","zip":"9876"}]
}