How to connect the Moz API to Google Sheets

Moz builds tools that make SEO, inbound marketing, link building, and content marketing easy. We can use the Moz API to import data from Moz into Google Sheets. In this tutorial, we’ll show you how to connect the Moz REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Obtain Access ID & Secret Key
  3. Choose a Moz endpoint
  4. Enter your Moz API request into Apipheny
  5. Run the Moz API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Obtain Access ID & Secret Key

Next login to your Moz account. In your API Dashboard, your Access ID and Secret Key will be displayed:

Moz API Dashboard
Moz API Dashboard

Copy these to a safe location, because you’ll need them later.

Step 3.) Choose a Moz endpoint

In this section, we’ll show you how to browse the Moz API documentation to find the endpoint which retrieves the information you need from your account. If you already know your API URL, or if you want to use the same example URL as us, just skip to Step 4.

First, open the Moz API documentation page: https://moz.com/help/links-api

The menu on the left contains the Links API menu.

Links API menu
Links API menu

If we click the Making Calls With Links API V2 item, the endpoints list will be displayed:

Links API endpoints
Links API endpoints

An example endpoint is Final Redirect, which returns the final redirect target of a page after following known redirects in the index. If no redirects are known, it returns an empty response. The is the API URL of that endpoint:

https://lsapi.seomoz.com/v2/final_redirect

The endpoint’s documentation contains a short description of the endpoint’s purpose, its URI, request syntax, example JSON request, the request parameters, example HTTP request, its HTTP method (POST), example cURL request and example Python request:

Final Redirect endpoint
Final Redirect endpoint

All API calls to the Moz API should be made with this base URL: https://lsapi.seomoz.com/v2/

Step 4.) Enter your Moz API request into Apipheny

Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET, POST, PUT, etc.) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 2, we explained how you can find the Moz REST API endpoint that you need. Now copy and paste your complete Moz API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).

For this example, we are using the Index Metadata endpoint, which returns an id that changes when the data in the index changes. This is what the whole URL looks like:

https://lsapi.seomoz.com/v2/index_metadata

Headers: In the Headers section of Apipheny, add one row with the following key and value:

Key:
Authorization

Value:
Basic encoded_string

When entering the header value, replace encoded_string with the Base64-encoded version of your Access ID and Secret Key. You can use https://www.base64encode.org/ to encode your access_id:secret_key string. Just enter your access id and secret key like this “access_id:secret_key” and then click “Encode”. More info about Base64 encoding.

Here’s what our Moz API request looks like in Apipheny:

Moz API request entered into Apipheny
Moz API request entered into Apipheny

Step 5.) Run the Moz API request in your Google Sheet

Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Moz API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

Moz data imported into Google Sheets
Moz data imported into Google Sheets

That’s it! You’ve successfully connected your Moz account to Google Sheets using the Moz API, Google Sheets API, and the Apipheny add-on.

After making a successful request to the Moz API, try querying a different Moz API endpoint, or try using one of the more advanced features in the Apipheny add-on.


Crypto API tutorials and more:


API Tutorials



API Knowledge

What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?