Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

IWebmasterApi.GetUserSites

Namespace: Microsoft.Bing.Webmaster.Api

IWebmasterApi.GetUserSites Method

Get user sites

Syntax

List<Site> GetUserSites()

Return Value
List of user sites

Examples

This example shows how to list all sites which are not verified.

namespace WebmasterApiExamples
{
    using System;

    internal class Program
    {
        private static void Main(string[] args)
        {
            var api = new WebmasterApi.WebmasterApiClient();

            foreach(var site in  api.GetUserSites())
            {
                if (!site.IsVerified)
                {
                    Console.WriteLine("Site \"{0}\" is not verified. Authentication code is {1}", site.Url, site.AuthenticationCode);
                }
            }
        }
    }
}

XML request sample

GET /webmaster/api.svc/pox/GetUserSites?apikey=EEDECC1EA4AE341CC57365E075EBC8B6 HTTP/1.1
Content-Type: application/xml; charset=utf-8
Host: ssl.bing.com

XML response sample

HTTP/1.1 200 OK
Content-Length: 301
Content-Type: application/xml; charset=utf-8

<ArrayOfSite xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Bing.Webmaster.Api" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Site>
<AuthenticationCode>258CAD36B9EEE22F1CFDEB4C239D26BB</AuthenticationCode>
<DnsVerificationCode>258cad36b9eee22f1cfdeb4c239d26bb.example.com</DnsVerificationCode>
<IsVerified>false</IsVerified>
<Url>http://example.com</Url>
</Site>
</ArrayOfSite>

JSON request sample

GET /webmaster/api.svc/json/GetUserSites?apikey=EEDECC1EA4AE341CC57365E075EBC8B6 HTTP/1.1
Content-Type: application/json; charset=utf-8
Host: ssl.bing.com

JSON response sample

HTTP/1.1 200 OK
Content-Length: 159
Content-Type: application/json; charset=utf-8


{
"d":[
{
"__type":"Site:#Microsoft.Bing.Webmaster.Api",
"AuthenticationCode":"258CAD36B9EEE22F1CFDEB4C239D26BB",
"DnsVerificationCode":"258cad36b9eee22f1cfdeb4c239d26bb.example.com",
"IsVerified":false,
"Url":"http:\/\/example.com"
}]
}

See Also

Show:
© 2015 Microsoft