Search for a user's contact

Back to People-Related Tasks

Searching for a user's contact requires accessing the search resource. It involves resource navigation from application to people to search, specifying in the query parameter the email address of the specified contact and the maximum number of values to return. The programming flow is illustrated in the following steps.

The steps here assume that you have already created an application and have received a response that contains the HREF for an application resource. For more information, see Create an Application.

  1. Send a GET request on the search resource following the links from people resource embedded in the application resource.

    GET HTTP/1.1
    Authorization: Bearer cwt=AAEB...buHcmvDs1Z7CzwgNEPoG3XyftjBYhE5zTT0buHc
    Accept: application/json
    X-Ms-Origin: http://localhost
    X-Requested-With: XMLHttpRequest
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
    Connection: Keep-Alive
  2. Process the response from the previous GET request to obtain the contact info.

    The response you receive should be 200 OK. The body of the response contains an array property named "contact" that is an array of individual contacts. Each item in the array includes information about a contact's URI, source network, and screen name, as well as links to other information about the contact.

    HTTP/1.1 200 OK
    Connection: Keep-Alive
    Content-Length: 3691
    Date: Thu, 17 Jan 2013 00:04:19 GMT
    Content-Type: application/json; charset=utf-8
    Server: Microsoft-IIS/7.5
    Cache-Control: no-cache
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
                  "company":"Metio","department":"Sales \u0026 Marketing","office":"20/2107",
                  "title":"Product Manager","emailAddresses":[""],
                  "name":"Sara Davis",