Unsolved url_metrics - Error deserializing POST body
-
Hi,
I'm trying to reproduce this Postman url_metrics request in Google Apps Script (GAS) :
But in GAS, I get this error :
I suspect it's the body (line 90) that causes the issue, but can't figure out how to fix it.
Any suggestion ?
-
Hello, try to use this way it will work:
$username='Access ID'; $password='Secret Key'; $URL='https://lsapi.seomoz.com/v2/url_metrics'; $payload = json_encode(array("targets" => ["moz.com"])); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$URL); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); $result=curl_exec ($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code curl_close ($ch); print_r(json_decode($result, true));
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
-
Unsolved Empty Response from API v1
Hi, I always receive a empty reponse from your API v1. Here ist my API call for further investigation:
API | | George4445
"http://lsapi.seomoz.com/linkscape/url-metrics/https://www.moz.com/?AccessID=mozscape-1234567890&Expires=1719916530&Signature=generatedsignaturecode" Reponse: {} Do you experience some problems with the api? Thank you very much
Regards George Shaylen0 -
Unsolved "The account does not have access to that quota" - API v1 URL Metrics
Hi! On one of our servers we get the message "The account does not have access to that quota" when pulling data for v1 URL Metrics endpoint in the API.
API | | aheitzman
This only happens on one specific server, others have worked flawlessly. Any idea of what might be going on? Thanks0 -
Unsolved Feature to add to my site to give people a domain score for their own site
Looking to add a feature on my website to invite people to submit their domain to get an SEO score (and a report). How do I do that? I think it involves the Moz API but not sure.
API | | mikeymosh0 -
Sample API call error
from mozscape import Mozscape client = Mozscape('xxxxx', 'xxxxx') # Now for some anchor text results anchorResults = client.anchorText('http://www.moz.com') # Or for just specific columns anchorTermResults = client.anchorText('http://www.moz.com', cols=Mozscape.ATCols.term) this is the error I am getting **mozscape.MozscapeError: HTTP Error 403: Permission denied: fpalgkadgnamhiblgpakemcfeedbebdcfk** My python is installed in appdata/local/programs and it is an enterprise environment. Thank you in advance!
API | | Sreenivas.Bathula0 -
Error Code 803
Hello all, With every new Moz report that comes in, an error code 803 appears. I check each link that comes up as an 803 but they work perfectly. What could be causing this to happen? Error Code 803: Incomplete HTTP Response Received Your page did not send a complete response to the Moz Crawler's request. Our crawler is pretty standard, so it's likely that other browsers and crawlers may also encounter this error. If you have this error on your homepage, it prevents the Moz crawler (and some search engines) from crawling the rest of your site.
API | | moon-boots0 -
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 -
Huge in crease in on page errors
Hi guys I’ve just checked my online campaign and I see errors in my crawl diagnostics have almost doubled from the 21<sup>st</sup> of October to the 25<sup>th</sup> of October going from 6708 errors to 11 599. Can anyone tell me what may have caused this? Also I notice we have a lot of issues with duplicate page titles which seems strange as no new pages have been added, can anyone explain why this might be? I look forward to hearing from you
API | | Hardley1110