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 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 Mozscape API subscription
We have questions regarding our subscription and the plan we are on. We are more interested in Mozscape API and not the features that we have access to currently. Will you let us know how we can change. Is there some one that we can chat with. Thanks,
API | | PatientPop
Naveen
naveen.sarabu@patientpop.com0 -
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 -
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 -
803 Crawl attempt error
Hello I'd be very grateful for any advice with this: My insights show I have an 803 error. Now, under "pages with crawl attempt error" the page in question is just an uploaded image to wordpress. However, above the graph it says: "We were unable to access your homepage, which prevented us from crawling the rest of your site. It is likely that other browsers as well as search engines may encounter this problem and abort their sessions." Does this really mean my homepage? or is the only issue with the image? I have noticed for the past 8 weeks I'm getting 1 crawl attempt error every 2 weeks (so when viewed weekly I have 1 error one week, 0 error the next week etc) Is this normal? Since receiving this 803 error, I have significantly dropped in SERPS for 3 key terms I was on page 1 for (now dropped to pages 3-4). Could this be related? I realise this is a bit specific, but thanks in advance. Cheers 🙂
API | | wearehappymedia0 -
Duplicate description error: one for meta one for og:type
I am getting the duplicate description error from Moz. I use both the og:description and . I am not sure if that is going to get me penalized by the search engines or my pages somehow discounted if I have meta description and og:description on the same page. What does Moz recommend? NOTE: for years I have followed this in the best practices format put out from other sources. Found at: http://webmasters.stackexchange.com/questions/52600/should-i-have-ogdescription-and-meta-description-together-on-every-page Short Answer: Use both! Long Answer: The OG stands for Open Graph which is apart of the Open Graph protocol of which works on platforms such as Facebook. The meta description element is for search engines such as Google, Yahoo and Bing. Since these are two separate tags that kinda do the same thing but they are designed for different types of platforms, one for Facebook and the other for Search Engines. The reasoning behind this is that the Open Graph protocal is more rich in what content can be feed to Facebook without scrapping the full page, think rich snippets. So images, description and more information is feed to Facebook via the Open Graph. Using both is a good idea.
API | | jessential0 -
Batch URL Error 413
Hello, i am using the free mozscape api to get the domain and page authority of urls. i am batching the url as shown in the sample code however i have over 500 URL i need to check and when running the request i get the following: stdClass Object ( [status] => 413 [error_message] => Too many urls in batch. Batches must be less than or equal to 200 urls. ) When i change it to 200 urls the request works fine, now is there a way to enable me to batch all 500 urls at once? i did read that the beta api is capable of batching urls in one request : http://moz.com/blog/400-higher-throughput-mozscape-api-now-in-beta-and-seeking-testers Has this been implemented yet into the current api? Thanks
API | | pauledwards0