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 Generate an Access ID and API key
Hello, I can't generate an Access ID and API key for my account.
API | | OlegShavilov
I need a Links API and I'm ready to buy a paid subscription, but I can't do it. Link https://moz.com/products/mozscape/access
Redirected to https://moz.com/api/dashboard And i dont see any options for create Access ID0 -
Unsolved Api limits on free plan
Good afternoon. I tried connecting free access to api https://moz.com/help/links-api/v1-archive/v1-free-api-access to retrieve DA data. After several requests to the api I got a message: "Your monthly row limit reached" Can you tell me what this error is related to? Or Moz doesn't have free api access anymore?
API | | Dima124dsfg1 -
Unsolved MOZ API to Google Data Studio
Dopes MOZ have anything like this? https://www.semrush.com/features/google-data-studio-connector/
Product Support | | WebMarkets0 -
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