IWebmasterApi.GetLinkCounts

Namespace: Microsoft.Bing.Webmaster.Api

IWebmasterApi.GetLinkCounts Method

Get list of site pages which has inbound links

Syntax

LinkCounts GetLinkCounts(
string siteUrl,
short page
)

Parameters

siteUrl
Type: System.String
Site url

page
Type: System.Int16
Page number
Return Value
LinkCounts object which contains one page of site pages which has inbound links.

Examples

Display all pages which has inbound links

LinkCounts linkCounts;
short page = 0;
do
{
    linkCounts = api.GetLinkCounts("http://example.com/", page);
    foreach (var link in linkCounts.Links)
    {
        Console.WriteLine("{0} {1}", link.Url, link.Count);
    }
} while (++page < linkCounts.TotalPages);

XML request sample

GET /webmaster/api.svc/pox/GetLinkCounts?siteUrl=http://example.com&page=0&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: 275
Content-Type: application/xml; charset=utf-8

<LinkCounts xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Bing.Webmaster.Api" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Links>
<LinkCount>
<Count>14</Count>
<Url>http://example.com/page1.html</Url>
</LinkCount>
</Links>
<TotalPages>3</TotalPages>
</LinkCounts>

JSON request sample

GET /webmaster/api.svc/json/GetLinkCounts?siteUrl=http://example.com&page=0&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: 189
Content-Type: application/json; charset=utf-8


{
"d":
{
"__type":"LinkCounts:#Microsoft.Bing.Webmaster.Api",
"Links":[
{
"__type":"LinkCount:#Microsoft.Bing.Webmaster.Api",
"Count":14,
"Url":"http:\/\/example.com\/page1.html"
}],
"TotalPages":3
}
}

See Also

Show: