Click to Rate and Give Feedback
MSDN
MSDN Library
Online Services
Live Services SDK
Methods
 POST Method
Collapse All/Expand All Collapse All
Live Services SDK
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.

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 equivalent of the ABContactUpdate SOAP API method:

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>

Description

The URI specifies the exact entry to be updated. In this example, the contact that is identified by the ContactID value has the e-mail address someone@example.com set as its default e-mail address.

Code

Header:
POST /livecontacts/contacts/contact(ContactID)/emails HTTP/1.1

Body:
<Email>
    <EmailType>EmailType<EmailType>
    <IsDefault>TrueFalse</IsDefault>
    <Address>EmailAddress</Address>
</Email>

For detailed information about possible error codes that are returned by this request, see Windows Live Contacts API: Error/Response Codes

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker