🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

asapi

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asapi

node js archivesspace rest client

Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
7
-41.67%
Maintainers
1
Weekly downloads
 
Created
Source

ArchivesSpace REST Api Client

NodeJS module providing common functions of the ArchivesSpace REST Api

Basic Info

Install:

$ npm install asapi

Use:

var api = new require('asapi')({url:"http://localhost:4567"});
api.ping(function(err, json) {
  console.log("ArchivesSpace version: " + json.archivesSpaceVersion);
});

Test:

$ npm install nodeunit -g
$ nodeunit test.js

Examples

Convert all extent information to metric system:

api.eachResource(function(resource) {
  var update = false;

  for (var i = 0; i < resource.extents.length; i++) {

    if (resource.extents[i] && resource.extents[i].extent_type == 'linear_feet') {
      resource.extents[i].number = (resource.extents[i].number * 0.3048) + "";
      resource.extents[i].extent_type = "linear_meters";
      update = true;
    }
  }

  if (update) api.updateRecord(resource, function(err, body) {
    if (err)
      console.log("uh oh " + err);
    else {
      console.log(body);
    }
  });

});

Keywords

archivesspace

FAQs

Package last updated on 14 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts