How To Use Our API to Get Website Contact Details

data-cables

For about 4 or 5 months now, we’ve had Link Cleanup and Contact available as a free service to anyone who wants to collect data on sites for outreach or link removal. The tool’s been doing pretty well, processing in the region of 700,000 to 1,000,000 new domains a month (yes, I was pretty surprised about that too!).

Anyway, we quietly launched a simple API service (you need to be logged into tools.seogadget.com to get to the API page), which the front end tool is actually based on. It’s been holding up pretty well so we’re developing it a little more this week to include extra data points and a faster response time. I’m pretty sure this is useful to people (judging by the number of requests we’re processing) so, if there’s something in there you’d like us to get for you – shout out in the comments.

Get yourself access

Firstly, if you want to play around with the API, you’ll need to get yourself a key. Do that by registering via your Twitter profile and head over to the API page.

The API endpoint looks like this:

http://tools.seogadget.co.uk/api/v1/get_data?linking_url=[yourURL]&apikey=[yourAPIkey]

About the data

Via simple http GET request, our RESTful API will respond with JSON. It’s really self explanatory and requires no authentication beyond the API key provided on the API page. Here’s a sample of our output:

{"google_domain_pagerank": 4, "google_pagerank": 4, "whois": null, "url": "http://seogadget.com/", "status_code": 200, "seomoz": {"root_domains_to_domain": 1016, "page_authority": 68, "domain_authority": 61, "root_domains_to_url": 515}, "sharedcount": {"google_plusones": 2058, "facebook_shares": 6, "tweet_count": 122, "facebook_likes": 2}, "gplus_display_name": null, "location": "GB", "ip": "95.142.152.37", "gplus_url": null}

Obviously, there’s a tonne of useful data in here, including whois, contact URL, host location of a site, IP address, Moz metrics, status code and some social data. For an example of what can be built on top of the API service, take a look at Kieran Headley’s SEO Candy Link Checker. Nifty!

How to extract the data into Excel

While the API’s obviously designed to supplement your applications, I think it’s totally cool for SEO’s to cobble together prototype applications in Excel. That’s why I’ve invested so much time and interest in platforms like the Adwords API Extension and the Links API Extension (for Mozscape and soon, Majestic). If you want to experiment, here’s a simple step by step process using =buildhttpdownloader and =jsonpathonurl, two functions in SEO Tools for Excel from Niels Bosma.

1) Concatenate a working, valid API request URL

Concatenate together a valid request URL (in my example above, my formula looks like this: =CONCATENATE($D$2,B7,$D$3)). When you’re happy, pick off a few URLs and check they’re forming valid requests by pasting them into a browser:

2) Configure BuildHttpDownloader

Consider “BuildHttpDownloader” a way for Excel to play nice. User agent emulation, caching and request delay are just a few features of the config function. It’s a very “play nice” way to fetch data from any API (like the Mozscape API before our Excel tool was first published).

Here’s the correct config:

=BuildHttpDownloaderConfig(TRUE,3000,,,,,,,,)

3) Fetch the data with JSONpathonURL

The final (and simplest!) bit is to use =JSONpathonURL to fetch the request URL and parse the required JSON response field to get the precious data. As you’ll see from teh creenshots above, I’ve set aside columns for Whois, Contcat URL and LinkedIn links.

The JSON response fields we’re going to try to parse are:

"email"
"contact_links"
"linkedin_links"

Here’s what a query might look like to extract the LinkedIn link for a site from our API call (where $D$5 is the location of our BuildHttpDownloader config):

=JsonPathOnUrl([@[request URL]],"$..linkedin_links",$D$5)

The end result isn’t always perfect (not all sites have a contact URL, or a LinkedIn profile link) but it’s definitely a good start:

Image credit: PressReleaseFinder

 

How To Use Our API to Get Website Contact Details, 4.1 out of 5 based on 10 ratings

Comments

  1. Roi Alon

    Great tool! im using the online version. there is something i’m missing on the steps using the API, there is any video instruction with steps?

  2. Perez Marc

    I successfully created the excel work sheet.
    But why doesn’t the API have the same fields as the online version?

    When I use the online version of this tools I get all the following fields:
    Whois contact email (WE)
    Contact url (CURL)
    Twitter url (TURL)
    Linkedin url (LKURL)
    Email (E)

    Thanks

  3. Perez Marc

    Could you send us a list of all the JSON fields? Would also be great if you create an excel document with a sample that loads all the values. I get a lot of #VALUE!.

  4. Mark Kaufman

    The online tool is great and I started playing around with the API. It doesn’t look like the API returns field for Safe/Spam, which the online tool does. Is that right? And if so, could that be added?