viaf
v1.0.0
Published
Wrapper around the VIAF API
Downloads
20
Maintainers
Readme
VIAF NPM
Wrapper around the VIAF API for Node.
BETA - there's a lot of work to be done, I'm just getting this out here for now.
Install
npm i viaf
Use
See the "example" directory.
var viaf = require('viaf');
viaf.autosuggest(query, callback);
viaf.read(id, callback);
viaf.read(id, dataType, callback);
viaf.search(query, callback);
The callback is passed three parameters in this order: any error that occurs, an HTTP response object, and the body (text) of the response. The read
method's default dataType is XML and its valid types are: html, xml, json (just returns a list of links to other authorities), rdf, json-ld, rss, marc21, marcxml, marchtml, unimarcxml, unimarchtml.
Examples
This is not meant to do much other than conveniently request & return data from VIAF, so among the tasks it won't perform: parse this data, provide an autocomplete widget, or provide a synchronous wrapper for operations. Look in the "example" folder to see how this package might be used to accomplish something actually useful.
See Also
More Details
Internally, this module uses request to call the VIAF API. You can pass options directly to request by overriding the viaf.requestOptions
object, which is passed directly to request.
License
CC0 Public Domain