INSERT Operation

The INSERT operation creates new objects. It inserts objects and their child objects. Newly created IDs are stored in the response XML. You can insert mutliple objects using a single request.

Example:

Request XML
<request version='1.0'>
  <header>
    <office>myoffice</office>
    <user>jdoe</user>
    <password>password</password>
  </header>
  <insert>
    <Contact>
      <LastName>Ackerman</LastName>
      <FirstName>Joseph</FirstName>
      <MiddleName>M</MiddleName>
      <Title>Dr</Title>
      <TaxID>111223333</TaxID>
      <Person>
        <Dob>1950-02-27</Dob>
        <Gender>1</Gender>
        <Occupation>Medical</Occupation>
        <JobTitle>Chief Of Staff</JobTitle>
        <Marital>2</Marital>
        <Salary>150000</Salary>
      </Person>
      <PreferredPhone>
        <AreaCode>626</AreaCode>
        <Number>5553505</Number>
      </PreferredPhone>
    </Contact>
    <Contact>
      <LastName>Ackerman</LastName>
      <FirstName>Marianne</FirstName>
      <TaxID>333445555</TaxID>
      <Person>
        <Dob>1953-07-28</Dob>
        <Gender>2</Gender>
        <Marital>2</Marital>
      </Person>
      <PreferredPhone>
        <AreaCode>626</AreaCode>
        <Number>5553505</Number>
      </PreferredPhone>
    </Contact>
 </insert>
</request>

Response XML
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <insert>
    <Contact id="Contact.1.31" _type="obj" _status="inserted">
      <PreferredPhone id="Phone.1.16" _type="obj" _status="inserted"/>
    </Contact>
    <Contact id="Contact.1.32" _type="obj" _status="inserted">
      <PreferredPhone id="Phone.1.17" _type="obj" _status="inserted"/>
    </Contact>
  </insert>
  <_status>OK</_status>
  <_systime>2015-06-03T18:55:06</_systime>
  <!--Cost 779 mill seconds.-->
</response>

When an activity object is inserted, the user who inserted the object is added as the activity's primary participant by default. To prevent this behavior, add the nodefaultparticipant attribute to the Activity element in your request, as shown in the following example (note that another user must be specified as the primary participant for this to work).

Request XML:
<request version='1.0'>
    <header>
        <office>myoffice</office>
        <user>jdoe</user>
        <password>password</password>
    </header>
    <insert>
        <Activity nodefaultparticipant = "true">
            <ContactID>Contact.1.4</ContactID>
            <Subject>Portfolio review</Subject>
            <Date>2016-05-27 15:00:00</Date>
            <Time>2016-05-27 15:00:00</Time>
            <EndTime>2016-05-27 16:00:00</EndTime>
            <Participants>
                <Participant>
                    <UserID>User.1.3</UserID>
                    <ParticipantRole>1</ParticipantRole>
                </Participant>
            </Participants>
        </Activity>
    </insert>
</request>


Topic revision: 28 May 2016, DinosLambropoulos
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback