Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
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));
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
-
Unsolved Help with API Error: "Query Not Found" for a Specific URL
Hi everyone, I'm trying to retrieve data for a specific URL using the Moz API, specifically the data.site.metrics.fetch method. The URL I'm querying is: https://www.fiftyfiveandfive.com/ai-agents-marketings-new-means-of-production When I make the API request, I receive the following 404 error: { "id": "unique-id-testing", "jsonrpc": "2.0", "error": { "code": -32655, "status": 404, "data": { "key": "site_query.query", "value": "https://www.fiftyfiveandfive.com/ai-agents-marketings-new-means-of-production" }, "message": "That query was not found." } } However, when I check the URL in Moz Link Explorer, I can see that the page has a Page Authority of 23 and a Domain Authority of 36, but no backlinks or ranking keywords. What I'm Trying to Achieve:
API | | Chris_Wright1664
I’m attempting to retrieve metrics for this page via the API, but it seems like the API does not recognise the URL, even though it’s visible in Link Explorer. Questions: Why does the API return "Query Not Found" for a URL that is indexed in Link Explorer? Is there a way to request Moz to crawl or re-crawl this URL to ensure it's accessible via the API? Are there any additional criteria the API requires (e.g., backlinks, ranking keywords) before it recognises a URL? Additional Info: I’ve verified that my robots.txt file allows all bots, including Rogerbot. list itemThe page is included in the sitemap, and the URL is accessible without any restrictions. list itemI’d appreciate any insights on how to resolve this issue or steps to take so that the Moz API can retrieve data for this URL.0 -
Unsolved Issue with API Results and Excessive Token Consumption
Dear Moz Support Team, I hope this message finds you well. I am writing to express my concerns regarding the performance of the Moz API, which I have been using for domain information retrieval through Zapier. Despite paying for your API service, I am encountering several significant issues that are affecting my ability to use the service effectively: Incorrect and Inconsistent Data: When I query domain information, I receive incorrect results for Page Authority (PA), Domain Authority (DA), and Spam Score (SS). Specifically, PA and DA are always returned as 1, while SS is consistently -1, which indicates that the data being provided is either incomplete or incorrect. This discrepancy is preventing me from relying on your service for accurate domain insights. Excessive Token Consumption: I have noticed that the API token usage is significantly higher than expected. After querying only 250 domains, my token consumption has already exceeded 6,000 tokens, which seems unusually high. I had understood that the token usage would be calculated per query, but it appears that the consumption is much higher than anticipated. Given that I have invested in this service, I am frustrated that I am not receiving the expected level of performance and data accuracy. Could you please investigate these issues and provide clarity on why this is happening? Additionally, I would appreciate any guidance on how to resolve these discrepancies and ensure that I am using the API in the most efficient way possible. I look forward to your prompt response and assistance in resolving these issues. thank you
Product Support | | tkddh13230 -
Unsolved MOZ API for domain authority
I am using the MOZ API to check domain authority (DA). Recently, I noticed a discrepancy: the DA value retrieved via the API differs from the result on the MOZ homepage. Specifically, the API returns a DA of 10, while the homepage shows "NO DATA." Additionally, other services like Ahrefs report a DA of 0. I relied on the MOZ API's result when purchasing this domain and now feel misled. I would like to understand the exact reason for this inconsistency.
API | | Skys0 -
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 -
Error with the MozBar
Hi Mozzers I am geting this very annoying message keeps popping up "Confirm 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" Issue is I cant even read it on my screen as it gets cut off and there is no scroll so had to copy and past into word to be able to read it. I had the issue for the last sever hours, is this my account or more general. Thanks Andy
API | | Andy-Halliday0 -
What is Moz's Error.aspx?aspxerrorpath HTTP Status 302 error message?
Hi, I am not sure what this error message is: "Error.aspx?aspxerrorpath". It immediately follows pages that are given at 302 status in Moz's crawl report. The same pages have never had this error before: | http://www.homedestination.com/news/2013/Minneapolis-home-price-appreciation.html | | http://www.homedestination.com/mortgage-worksheet.html | | http://www.homedestination.com/foreclosure-eligibility.html | Each page has a 100% score with WC3. Could you give me more insight as to what Moz may suggest I do to give the page a 200 HTTP status as before? Thanks.
API | | jessential0