Put Operation
Make updates to individuals in your org, one at a time or in groups.
The PUT method allows partial updates, so if some updates fail but others succeed, the successful updates aren’t rolled back. This behavior is different than POST, which is to roll back all changes if there is any error. The individual’s ID value, individualid__c, uniquely identifies the record, so you must always include it in the request body. If you omit the ID value, the update request is ignored for that individual.
In the POST example, we created two records. Now let’s modify those individuals to change their email addresses, again using an org with the namespace clinic01. The PUT method is /services/apexrest/clinic01/v1/individual/.
Here’s the request body that identifies the individuals and lists the values to update.
Here’s
the complete
response.
The
status code of 4 tells us that the update
operation was successful. Looking at the individualUpdated values in the response body tells us that all the updates were
successful.
1{
2 "individuals" :
3 [
4 {
5 "individualid__c" : "001B000000AfFR6IAN1455067013084",
6 "email" : "RJ@yahoo.com"
7 },
8 {
9 "individualid__c" : "001B000000AfFR7IAN1455067013084",
10 "email" : "James@yahoo.com"
11 }
12 ]
13}1{
2 "statusCode" : 4,
3 "responseBody" :
4 {
5 "001B000000AfFR7IAN1455067013084" :
6 {
7 "errorFields" : "",
8 "errorMessage" : "",
9 "individualUpdated" : "true"
10 },
11 "001B000000AfFR6IAN1455067013084" :
12 {
13 "errorFields" : "",
14 "errorMessage" : "",
15 "individualUpdated" : "true"
16 }
17 },
18 "message" : "Individuals Updated,Please check response body for detailed update status"
19}