The Library of Congress techcenter page at http://id.loc.gov/techcenter/ gives examples accessing linked data.
For example:
curl -L -H 'Accept: application/json' http://id.loc.gov/vocabulary/preservationEvents/creation
Running the above example returns a json response - I have done this.
But when I try a Nodejs script to access the same url - with the Accept header, it returns a "404 Not Found" error.
Here is my script:
'use strict';
const request = require('request');
var url = "http://id.loc.gov/vocabulary/preservationEvents/creation";
var options = {
url: url,
headers: {
"Accept": "application/json"
}
};
request(
options,
(error, response, body) => {
if (error) {
return console.error(error);
}
if (response.statusCode == 200) {
var resp = JSON.parse(body);
console.log(resp);
return console.log(body.substr(0, 128) + '...');
}
else {
return console.error('Error: Response statusCode='+response.statusCode);
}
}
);
I have tried this on my mac and also on a Digital Ocean Ubuntu server - both giving a 404 Not Found result.
If you have a minute, I would appreciate knowing if you were able to get a response using this script - or let me know if you see a bug.
Any help is appreciated.
Thanks
Colin Goldberg