Post Operation

Create individuals one at a time or in batches. Use the POST method to create individuals in your org. You can create more than one individual at a time, but it’s an all-or-none operation. If an error occurs while creating any individual’s record, no individuals are created.

Individuals are created using a map of field names and field values. You include only the fields that must have values in your org. Here’s an example that creates two individuals with minimal information, using an org with the namespace clinic01.

1/services/apexrest/clinic01/v1/individual/
Here’s the request body that defines the individuals to add. lastname is required here because it’s required by the Salesforce Contact object. Contact is the parent object of an individual.
1{
2"individuals":
3  [
4    {
5      "firstname" : "Robert",
6      "lastname" : "Jones",
7      "Email" : "RJ@gmail.com",
8      "SourceSystemId__c" : "abc-123-4567",
9    },
10    {
11      "firstname" : "Virgil",
12      "lastname" : "James",
13      "Email" : "James@gmail.com",
14      "SourceSystemId__c" : "xyz-789-1234",
15    }
16  ]
17}
The complete response contains all the individual’s fields, including the ones we didn’t set. The unset fields are omitted in this response for brevity.
1{
2  "statusCode" : 2,
3  "responseBody" :
4  [
5    { 
6      "email" : "RJ@gmail.com",
7      "firstname" : "Robert",
8      "lastname" : "Jones",
9      "accountid" : "001B000000AfFR6IAN",
10      "clinic01__individualtype__c" : "Individual",
11      "clinic01__sourcesystemid__c" : "abc-123-4567",
12      "clinic01__primarycontact__c" : "003B0000006A5QKIA0",
13      "recordtypeid" : "012B00000006W3cIAE",
14      "id" : "003B0000006A5QKIA0"
15    },
16    {
17      "email" : "James@gmail.com",
18      "firstname" : "Virgil",
19      "lastname" : "James",
20      "accountid" : "001B000000AfFR7IAN",
21      "clinic01__individualtype__c" : "Individual",
22      "clinic01__sourcesystemid__c" : "xyz-789-1234",
23      "clinic01__primarycontact__c" : "003B0000006A5QLIA0",
24      "recordtypeid" : "012B00000006W3cIAE",
25      "id" : "003B0000006A5QLIA0"
26    }
27  ],
28  "message" : "Number of Individuals created successfully: 2"
29}

The clinic01__individualtype__c field represents the custom field, individualtype__c, which is for Salesforce internal-use only.

Note

The status code of 2 tells us that the create operation was successful, and the message confirms it.