IWebmasterApi.GetUserSites Method

Definition

Get user sites

public:
 System::Collections::Generic::List<Microsoft::Bing::Webmaster::Api::Interfaces::Site ^> ^ GetUserSites();
[System.ServiceModel.FaultContract(typeof(Microsoft.Bing.Webmaster.Api.Interfaces.ApiFault))]
[System.ServiceModel.OperationContract]
[System.ServiceModel.Web.WebGet(BodyStyle=System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest)]
public System.Collections.Generic.List<Microsoft.Bing.Webmaster.Api.Interfaces.Site> GetUserSites ();
abstract member GetUserSites : unit -> System.Collections.Generic.List<Microsoft.Bing.Webmaster.Api.Interfaces.Site>
Public Function GetUserSites () As List(Of Site)

Returns

List<Site>
Attributes

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=sampleapikeyedecc1ea4ae341cc8b6 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=sampleapikeyedecc1ea4ae341cc8b6 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"
}]
}

Remarks

Applies to