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://mza.seotoolninja.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
-
When I click into the moz bar on our website www.essexparts.com it shows that the URL is Canadian and shows a Canada flag. The website and company are in the US. Can someone please explain this?
When I click into the moz bar on our website www.essexparts.com it shows that the URL is Canadian and shows a Canada flag. The website and company are in the US. Can someone please explain this? Also does the location have any bearing on how it shows up in google? XNQOQoJ
API | | Tindol0 -
How can I get "Date First Seen","Date Last Seen" and "Date Lost" from the API?
"Date First Seen","Date Last Seen" and "Date Lost" are columns in the CSV exported from LinkExplorer's Inbound Links page. How do I get that data from the API?
API | | StevePoul1 -
Mozscape API Updates (Non-updates!) - becoming a joke!
This is the 3rd month in succession where the Mozscape index has been delayed. Myself and clients are losing patience with this, as I am sure many others must be. Just what do you suppose we tell clients waiting for that data? We have incomplete and sometimes skewed metrics to report on, delays which then get delayed further, with nothing but the usual 'we are working on it' and 'bear with us'. It's becoming obvious you fudged the index update back in January (see discussion here with some kind of explanation finally from Rand: https://mza.seotoolninja.com/community/q/is-everybody-seeing-da-pa-drops-after-last-moz-api-update), and seems you have been fumbling around ever since trying to fix it, with data all over the place, shifting DA scores and missing links from campaign data. Your developers should be working around the clock to fix this, because this is a big part of what you're selling in your service, and as SEO's and marketers we are relying on that data for client retention and satisfaction. Will you refund us all if we should lose clients over this?! .. I don't think so! With reports already sent out the beginning of the month with incomplete data, I told clients the index would refresh April 10th as informed from the API updates page, only to see it fudged again on day of release with the index being rolled back to previous. So again, I have to tell clients there will be more delays, ...with the uncertainty of IF it WILL EVEN get refreshed when you say it will. It's becoming a joke.. really!
API | | GregDixson2 -
Error when generating secret API key
Hi, I am trying to generate an API key for the past 24 hours and I keep on getting the same vague explanation (attached below) of the error. Help Hub had no responses regarding the error also. "Oops - Something went wrong while trying to get your API Credentials. Please try again or check out the Help Hub if you are still experiencing issues." Appreciate any assistance on solving this issue. Thanks! Ian
API | | kwaken0 -
Keywords API
Does MOZ offer any statistics/data about keywords through the API? I didn't see anything in the documentation... Thanks! Justin
API | | Campaignium0 -
API Limit Question
Hi, I am unfamiliar with API's in general but never had an issue with being throttled until today. I used the api a lot heavier today which is why. According to the API dashboard I made 5100 "requests" today and 21,000 "rows returned". I am using a MOZ PRO account and have been throttled as a result. I am wondering when does it reset? Is it a daily, weekly, or monthly limit that I hit and what is the limit? Thanks
API | | greganderson4440 -
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 -
Integrate Piwik data with Moz instead of Google Analytics?
Hello everyone, The company I work for had Google Analytics for all of our websites, dating back at least 4 years. Because of our email infrastructure, we accessed Analytics through a temporary account. Now this account worked fine for 4 years, until over the last two weeks where at some point Google deleted that account, and the Analytics connected to it. I've had no response from Google regarding this, but that's by the by. Anyway, I've made the decision to bring the analytics in house and hold the data ourselves. I've chosen Piwik for this, and it's been running fine for the last few days. However, I know Moz integrates with Google Analytics, but at the moment this is useless to me. Is there a way, or are there any plans, to integrate Piwik with Moz? If not, what benefits will I lose if I discontinue using Google Analytics with Moz?
API | | theponyclub0