Skip to content

Instantly share code, notes, and snippets.

@say4n
Created April 18, 2016 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save say4n/869705e1081a2bdb276eb187476805bb to your computer and use it in GitHub Desktop.
Save say4n/869705e1081a2bdb276eb187476805bb to your computer and use it in GitHub Desktop.
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
This simple API for Wayback is a test to see if a given url is archived and currenlty accessible in the Wayback Machine. This API is useful for providing a 404 or other error handler which checks Wayback to see if it has an archived copy ready to display. The API can be used as follows:
http://archive.org/wayback/available?url=example.com
which might return:
{
"archived_snapshots": {
"closest": {
"available": true,
"url": "http://web.archive.org/web/20130919044612/http://example.com/",
"timestamp": "20130919044612",
"status": "200"
}
}
}
if the url is available. When available, the url is the link to the archived snapshot in the Wayback Machine At this time, archived_snapshots just returns a single closest snapshot, but additional snapshots may be added in the future.
If the url is not available (not archived or currently not accessible), the response will be:
{"archived_snapshots":{}}
Other Options
Additional options which may be specified are timestamp and callback
timestamp is the timestamp to look up in Wayback. If not specified, the most recenty available capture in Wayback is returned. The format of the timestamp is 1-14 digits (YYYYMMDDhhmmss) ex:
http://archive.org/wayback/available?url=example.com&timestamp=20060101
may result in the following response (note that the snapshot timestamp is now close to 20060101):
{
"archived_snapshots": {
"closest": {
"available": true,
"url": "http://web.archive.org/web/20060101064348/http://www.example.com:80/",
"timestamp": "20060101064348",
"status": "200"
}
}
}
callback is an optional callback which may be specified to produce a JSONP response.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment