News:

Build a stunning handcrafted website with IT Acumens

Main Menu

Windows Live Contacts API Methods: POST

Started by thiruvasagamani, Jan 22, 2009, 04:12 PM

Previous topic - Next topic

thiruvasagamani

Windows Live Contacts API Methods: POST

The HTTP/1.1 POST method request is used for inserting data under the location that is specified by the Uniform Resource Identifier (URI). This method can be used to insert a member of a collection, for example an Email container under the Emails URI or a Contact container under the Contacts URI. Multiple child objects can be created by using a single POST request.

When the request is successful, the response code is the "201 Created" status code, and the response header contains the URI of the newly created object.
Remarks

The POST request cannot be used to insert a single-value element. For example, the Owner collection is a single-value element since there is only one Owner container element within the LiveContacts collection. When the collection is created, empty child elements are automatically created. Therefore, you cannot insert these elements by using the POST request. Instead, these empty elements must be updated. The PUT method must be used to update these empty elements.

A POST request can include any child containers or elements as necessary. For example, a single POST request can be used to create an entire contact, including all of its e-mail addresses and telephone numbers.

The URI contains the parent ID for the update. Therefore, the ID for that container is not required. If the parent ID is invalid, the insertion will fail, and a new Contact container will not be created. For example, the following request is valid and is the HTTP
Header:
POST /LiveContacts/contacts/contact(ContactID) HTTP/1.1

Body:
<Contact>
    <Profiles>
        <Personal>
            <LastName>LastName</LastName>
            <SpouseName>SpouseName</SpouseName>
        </Personal>
        <Professional>
            <JobTitle>JobTitle</JobTitle>
        </Professional>
    </Profiles>
    <Emails>
        <Email>
            <EmailType>EmailType</EmailType>
            <Address>EmailAddress</Address>
        </Email>
        <Email>
            <EmailType>EmailType</EmailType>
            <Address>EmailAddress</Address>
        </Email>
    </Emails>
    <Phones>
        <Phone>
            <PhoneType>PhoneType</PhoneType>
            <Number>PhoneNumber</Number>
            <IsDefault>TrueFalse</IsDefault>
        </Phone>
        <Phone>
            <PhoneType>PhoneType</PhoneType>
            <Number>PhoneNumber</Number>
            <IsDefault>TrueFalse</IsDefault>
        </Phone>
    </Phones>
</Contact>



Source : MSDN
Thiruvasakamani Karnan