Does anyone have an example of using the Moz API with curl in bash?
-
Does anyone have an example of using the Moz API with curl in bash?
-
The link metrics documentation can be found here: https://moz.com/help/guides/moz-api/mozscape/api-reference/link-metrics
Great example for url-metrics!
-
However, what is the API call for getting backlinks?
-
Anytime!
-
sweet! thanks! it works! here is my example for anyone else:
#!/bin/bash
access_id="xxxxxxx"secret_key="xxxxxxxxxxxxxx"
The number of external links to the URL, including nofollowed links
External links: 549755813888 ued
The number of external links to the subdomain, including nofollowed links
External links to subdomain: 140737488355328 fed
The number of external links to the root domain, including nofollowed links
External links to root domain: 2251799813685248 ped
searchurl=$1
echo "Checking backlinks for ["$searchurl"]"
endpoint="lsapi.seomoz.com"call="/url-metrics/${searchurl}%2fCols=1073741825"
call="/url-metrics/${searchurl}%2fCols=549755813888"
timenow=$(date +%s)
timeend=$(( ${timenow} + (606024) ))
stringToSign=${access_id}$'\n'${timeend}
signature=$(echo -n "${stringToSign}" | openssl dgst -sha1 -hmac "${secret_key}" -binary | base64)
signature=$(echo ${signature} | sed 's/+/%2B/g;s/=/%3D/g')http://lsapi.seomoz.com/linkscape/url-metrics/moz.com%2Fblog?Cols=4&AccessID=member-cf180f7081&Expires=1225138899&Signature=LmXYcPqc%2BkapNKzHzYz2BI4SXfC%3D
http://lsapi.seomoz.com/linkscape/url-metrics/moz.com%2FCols=1073741825?AccessID=mozscape-9d88c16268&Expires=1476310241&Signature=Nuy5h4bV5Gkyw5s2X09E9WJ3sGQ%3D
for i in {1..250}; do
curl "http://lsapi1.seomoz.com/linkscape/links/10.portal.athenahealth.com?Filter=external&SourceCols=133982846973&TargetCols=133982846973&Sort=page_authority&AccessID=${access_id}&Expires=${timeend}&Signature=${signature}&Scope=page_to_domain&Limit=5&Offset=$((i100))&"
done| tr "}" "n" | perl -pe "s/[][]//g" | perl -pe "s/,{//g" | perl -pe "s/"[^"]"://g" | perl -pe "s/^{//g" >> output.csv
url="http://$endpoint/linkscape$call?AccessID=${access_id}&Expires=${timeend}&Signature=${signature}"
echo "Calling Moz API with ["$url"]"
curl $url
echo -
Hi Carl
We do not have documentation but here is an old post that should work:
https://www.distilled.net/blog/seo/rapid-protoyping-with-the-seomoz-api/
Hope this helps!
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Is there a way to connect Moz to Databox?
Is there a way to pull data from Moz into other applications, such as Databox? If possible, how do I set this up?
API | | jenmilehigh1 -
API metrics for discovered and lost linking domains
Hello, Could you tell me, can I use the api to get such data as ‘Discovered in the last 60 days’ and ‘Lost Links’?
API | | OlegKireyenka
If yes, which values of ‘Cols’ in URL Metrics I can use? Thank!0 -
Integrating Moz with DashThis
I'm trying out DashThis as a way to visualize data for clients with whom we do a combo of SEO, PPC, and SEM work. I like the main Moz Pro campaign dashboard page for distilling top-level information and the rankings page for tracking keyword ranks. In an ideal world, I'd love to be able to sort replicate these within DashThis. I see that DashThis does integrate with Moz but looking at the Mozscape API documentation I couldn't tell if this type of integration is possible in DashThis. I realize this is a super specific question, but I thought I'd ask the community if this integration is possible or if I have more limited range of options.
API | | TheKatzMeow0 -
Moz Thumbs not working? @MozHelp
Hi all, I'm noticing an issue with Moz thumbs. Last night before bed, I am pretty positive I gave EGOL and Laura a thumbs up for their answers to this question. This morning I noticed there were no thumbs up for their responses. At first I thought maybe I didn't give them a thumbs up, and proceeded to thumb them again. Everything appeared to work, however after returning to the post I noticed my thumbs didn't appear to be recorded. Has anybody noticed this issue?
API | | donford0 -
Is there a way to connect to MOZ Pro data via Tableau?
Looking to automate reporting data from MOZ Pro. Specifically, site audit and keyword ranking data. Would like to connect to MOZ Pro backend via Tableau. Not seeing an obvious way to do this. Any guidance?
API | | jevons0 -
Extracting MOZ Domain Authority
Hi
API | | SteveWarren
I have looked but cannot find any reference to this, so I hope someone can help me.
Is it possible to upload a list of domain URLs and retrieve their MOZ Domain Authority?
Many thanks
Steve0 -
Moz api request problem fail (status 401)
Hello! I'm getting an error for seomoz call using API: {"status":"401","error_message":"Your authentication failed. Check your authentication details and try again. For more information on signed authentication, see: http://apiwiki.moz.com/signed-authentication"} Can you help me?
API | | leoh0 -
How much attention should I pay to Moz's DA/PA?
Hola! I've been optimising a site since October and our hard work has yielded a sizeable increase in organic traffic, revenue, quality, relevant links and Search Metrics scoring since commencing the campaign. After yesterday's Moz update, the DA has dropped slightly and a number of pages' PAs have dropped significantly (i.e. from 27 to 17). So here are my questions: My 'white hat' optimisation is clearly working. The site is enjoying more than 100% year-on-year increase in organic traffic and we're currently pulling in more organic visitors than ever before. Why is Moz's score not reflecting this? Some of the pages that have seen sizeable PA drops have had their URLs changed since the last Moz update. For example, I've optimised a URL from www.mysite.com/cases-covers to www.mysite.com/phone-cases to coincide with search volumes. I've added optimised content to this page too, but the PA has dipped from 27 to 17. A 301 redirect has been correctly added, and this is evident by a PA of 17 and not zero, which is what a brand new page would have. Am I paying too much attention to Moz's scores? It's a bit disheartening to see a drop after a lot of hard work. However, I guess the only thing that really counts is an increased volume of search traffic and revenue, right? Cheers, Lewis
API | | PeaSoupDigital0