IWebmasterApi.GetLinkCounts(String, Int16) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get list of site pages which has inbound links
public:
Microsoft::Bing::Webmaster::Api::Interfaces::LinkCounts ^ GetLinkCounts(System::String ^ siteUrl, short page);
[System.ServiceModel.FaultContract(typeof(Microsoft.Bing.Webmaster.Api.Interfaces.ApiFault))]
[System.ServiceModel.OperationContract]
[System.ServiceModel.Web.WebGet(BodyStyle=System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest)]
public Microsoft.Bing.Webmaster.Api.Interfaces.LinkCounts GetLinkCounts(string siteUrl, short page);
abstract member GetLinkCounts : string * int16 -> Microsoft.Bing.Webmaster.Api.Interfaces.LinkCounts
Public Function GetLinkCounts (siteUrl As String, page As Short) As LinkCounts
Parameters
- siteUrl
- String
- page
- Int16
Returns
- Attributes
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=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: 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=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: 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
}
}