Can the Google Webmaster Tools API be used to automate fixing URL Page Not Found Errors?
-
17-06-2021 - |
Question
If I go into Google Webmaster Tools, and click Health->Crawl Errors
, I noticed that our site has about 1,045 Not Found errors.
Each of these errors can be fixed manually by:
- filtering through the list to find the specified error that has been needs to be fixed, and clicking on it.
- In the resulting dialog clicking the
Fetch as Google
link, - Clicking
Fetch
- And finally, clicking
submit the index
(provided there are enough fetches remaining to do so), and then marking it asfixed
.
Since there are about 1,000 errors to fix, doing this manually seems a bit out of the question.
(Note: I didn't have anything to do with it but the site was migrated before the content causing the errors.)
I'm aware that it is possible to retrieve a list of site errors, but that's really only half the battle. I looked over the APIs and didn't really find a way to use the Webmaster Tools API to mark errors as fixed.
Solution
Marking errors as "fixed" is perfectly possible with this API call:
So you can easily automate this by e.g. …
- fetching the crawl error sample (1000 max.)
- checking the given URLs
- marking working URLs as fixed via API
Keep in mind: Crawl error information is updated about once a day. So if there are more than 1000 errors and half of them get marked as fixed, new data that was not in the sample before will likely roll in after a day has passed.
OTHER TIPS
I'm not sure what your question is, as I just successfully tested removing all errors (4 in my case) which was possible with just a few clicks. If the errors keep reappearing you might want to take a look at where the invalid URLs are linked from: if it's internal stuff, you should fix those links, and if it's external links you should either add redirects to the updated/moved pages, or ask the external web site(s) to update their links to your site.