Newer Version Available
sObject Tree
In the request data, you supply the record hierarchies, required and optional field values, each record’s type, and a reference ID for each record. Objects are created in the same order that they’re listed in the request. Upon success, the response contains the IDs of the created records. If an error occurs while creating a record, the entire request fails. In this case, the response contains only the reference ID of the record that caused the error and the error information. The response bodies and HTTP statuses of the requests are returned in a single response body. The entire request counts as a single call toward your API limits.
- Up to a total of 200 records across all trees
- Up to five records of different types
- sObject trees up to five levels deep
Because an sObject tree can contain a single record, you can use this resource to create up to 200 unrelated records of the same type.
- Root records across all sObject trees in the request
- All second-level records of the same type—for example, second-level Contacts across all sObject trees in the request
- All third-level records of the same type
- All fourth-level records of the same type
- All fifth-level records of the same type
Syntax
- URI
- /services/data/vXX.X/composite/tree/sObjectName
- Formats
- JSON, XML
- HTTP method
- POST
- Authentication
- Authorization: Bearer token
- Parameters
- None required
- Request body
- sObject Tree Request Body
- Response body
- sObject Tree Response Body
Example
- For an example of creating unrelated records of the same type, see Create Multiple Records.
- For an example of creating nested records, see Create Nested Records.