Last updated: 2024-06-07
Insert Operation
The insert operation creates objects and their child objects. The ID of the new object is returned in the response XML.
Tip: Enclosing insert requests in the transaction element is recommended to prevent data issues caused by connection interruptions or other problems.
The following example insert request creates a contact object and a child object (preferred phone number):
XML
<request version="1.0">
<header>...</header>
<insert>
<Contact>
<LastName>Ackerman</LastName>
<FirstName>Joe</FirstName>
<PreferredPhone>
<AreaCode>626</AreaCode>
<Number>5853505</Number>
</PreferredPhone>
</Contact>
</insert>
</request>The response XML returns the status of the requested operation and the IDs of the new object and its child object:
XML
<response version="1.0">
<header>...</header>
<insert>
<Contact id="Contact.123.456" _status="inserted">
<PreferredPhone id="Phone.123.789" _status="inserted"/>
</Contact>
</insert>
</response>