The last few days has seen news released that the Yahoo/Bing relationship will result in “Microsoft Webmaster Tools to support Yahoo! Site Explorer Community“, or as interpreted by Barry Schwartz at Search Engine Land “Yahoo Shutting Down Site Explorer This Year“.


Image of time bomb - indicating the predicted end of site explorer may cause difficulty to some?
Whilst many businesses have already begun transitioning to different toolsets, we suspect that there are many others who have yet to begin this process – indeed, we anticipate that some businesses may have systems written by developers, who may have since left the organisation, leaving those responsible for the systems unaware of the potential “ticking time bomb” and subsequent risks to their business – if you have never questioned where your backlinks intelligence is sourced, now may be an appropriate time.

Whilst the Majestic SEO API is not quite a drop-in replacement for Yahoo/BOSS, we believe that the Majestic SEO API provides similar functionality, and migration need not be complex. We are also very open about where the data comes from – providing valuable peace of mind and confidence during a potentially turbulent time for link intelligence providers.

The purpose of this post is to provide a developer perspective on our API, and how it can be used – as a start, here is a review of some of the material we have previously written about the use of Majestic API:

Getting into the Majestic API

 

Assuming you are a registered user on the Majestic SEO website, in order to get access to the developer API, you will first need an API Key.


An API key is required to unlock the Majestic API
To obtain an API key, you’ll need an API enabled package – our Majestic Platinum package provides one for internal use, and we also have a developer API with a deliberately restricted data set to enable developers to develop applications before hitting real world usage limits. If you need a developer API key, please contact us using our support system. Please include the name of the business and if you anticipate using our Platinum Plan following development, or if you anticipate requiring Reseller rights

Using Your API Key

 

Now you have your API key, you have a choice. You can either hand craft your own API queries, or use one of our “connectors” – the code for which is available in a number of languages ( perl, php, ruby, c# and java as of time of writing ) on our developer homepage.

Some basic stats

 

One of our most popular functions is called GetIndexItemInfo. GetIndexItemInfo returns some of the headline totals visible in our site explorer product, and many other places all over the internet. Its not uncommon for us to get 100s of requests per second for this command.

If you do want to roll your own connector, here is the response in XML:

<?xml version="1.0" encoding="utf-8"?>
<Result Code="OK" ErrorMessage="" FullError="">

    <GlobalVars IndexBuildDate="17/04/2010 16:43:46" MostRecentBackLinkDate="2010-03-25"/> 
    <DataTables Count="1">

        <DataTable Name="Results" RowsCount="1" Headers="ItemNum|Item|ResultCode|Status|ExtBackLinks|RefDomains|AnalysisResUnitsCost|ACRank|ItemType|IndexedURLs|GetTopBackLinksAnalysisResUnitsCost|
        RefIPs|RefSubNets|RefDomainsEDU|ExtBackLinksEDU|RefDomainsGOV|ExtBackLinksGOV|RefDomainsEDU_Exact|ExtBackLinksEDU_Exact|RefDomainsGOV_Exact
        |ExtBackLinksGOV_Exact">

            <Row>0|majesticseo.com|OK|Found|28381|1229|28381|-1|1|4774|28381|1074|954|1|5|0|0|0|0|0|0</Row> 

        </DataTable> 

    </DataTables>
    </Result>

 

We do provide example code to call this with our connectors, so I won’t repeat it here – instead lets look at an example script to show some backlinks for a given page in a couple of programming languages.

Does the Majestic SEO API have an “inlink” command?

 

Many users love Yahoo BOSS for the “inlink” command. The closest command in the Majestic SEO API to inlink is “GetTopBackLinks” – which, as its name implies, returns the top backlinks ( by AC Rank ) for a given:

  • URL ( http://www.example.org/home.html ),
  • Sub Domain ( www.example.org ),
  • or Domain ( *.example.org ).

Get Backlinks in PHP:

 

Our responses are formed from message level parameters, data tables, and table level parameters, all of which are available via the Object Orientated Interface.

<?php

require './APIService.php';

$api_key = "[ INSERT API KEY HERE ]";

$url = "http://www.example.com";
$endpoint = 'http://developer.majesticseo.com/api_command';
$api_service = new APIService($api_key, $endpoint);

$parameters = array();

$parameters["datasource"] = "fresh";
$parameters["MaxSourceURLs"] = 10;
$parameters["URL"] = $url;
$parameters["GetUrlData"] = 1;
$parameters["MaxSourceURLsPerRefDomain"] = 1;

$response = $api_service->executeCommand("GetTopBackLinks", $parameters);

if ( $response->isOK() == "false" )
{
 echo "Error Occured" . $response -> getErrorMessage();
 exit;
}

$table = $response->getTableForName("URL");

$rows = $table->getTableRows();

foreach ( $rows as $row)
{
 echo "URL: ".$row["SourceURL"] ."\n";
 echo "AC Rank: ".$row["ACRank"] ."\n";
} 

?>

 

Get Backlinks in Perl:

 

The perl connector makes it easy to get the data and display it without worrying about http requests or xml formatting:

#!/usr/bin/perl

use strict;
use warnings;

use MJ12::Remote::ApiService;

my $api_key = "[ INSERT API KEY HERE ]";

my $url = "http://www.example.com";
my $endpoint = 'http://developer.majesticseo.com/api_command';

my $api_service = new MJ12::Remote::ApiService('ApplicationApiKey' => $api_key, 'Endpoint' => $endpoint);
my $response = $api_service->executeCommand('Name' => 'GetTopBackLinks', 'Params' => { MaxSourceURLs => 10, URL => $url, GetUrlData => 1, MaxSourceURLsPerRefDomain => 1, datasource => "fresh" } );

# check the response code.
die $response->errorMessage unless ( $response->isOK() );

# dump results table.
my $results = $response->tableForName('Name' => 'URL');

foreach my $row ( @{$results->rowsAsArrayRef()} )
{
	print "URL: ".$row -> {"SourceURL"} ."\n";
	print "AC Rank: ".$row -> {"ACRank"} ."\n";
}

 

Fresh and Historic

The “datasource” parameter can be used to point your query at either our “fresh” or “historic” indexes. In the developer sandbox, both indexes return the same data, so its well worth testing counts against Majestic Site Explorer once the code is connected to the enterprise.majesticseo.com endpoint.

In Conclusion…

 

At Majestic we have had over 5 years experience in backlinks analysis, and run one of the largest publicly queryable indexes of backlinks information on the planet – we know of no single-source backlinks provider with a larger index. Our services already power some major players in search engine intelligence, so we hope you can be confident of our commitment to deliver and develop our world class backlinks intelligence Service.

As a final thought, despite rumours on twitter to the contrary, there have been no parties at Majestic as a result of the announced closure of Site Explorer, as we have nothing but respect for the talented engineers who developed and maintained this powerhouse of internet analytics. We hope they all move onto bigger and better things.

Steve Pitchford
Latest posts by Steve Pitchford (see all)

Comments

Comments are closed.

THANK YOU!
If you have any questions in the meantime, please contact help@majestic.com
You have successfully registered for a Majestic Demo. A Customer Advisor will contact you shortly to schedule a suitable time to connect.