
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
dspace-rest
Advanced tools
NodeJs client for DSpace 7+ REST API
Note: This is the successor of dspace7-node
npm install dspace-rest
The package provides a command-line interface (CLI) for interacting with DSpace servers directly from your terminal.
The CLI is available as dspace-cli. You can run it in a few ways:
Using npx without prior installation (recommended for quick use or one-off commands):
This command will temporarily download the dspace-rest package (if not already cached) and then execute
dspace-cli.
npx -p dspace-rest dspace-cli --help
If dspace-rest is a dependency in your project:
After running npm install dspace-rest or yarn add dspace-rest in your project:
npx dspace-cli --help
If dspace-rest is installed globally:
After running npm install -g dspace-rest:
dspace-cli --help
Before using most commands, set your DSpace server URL and login credentials:
dspace-cli -h
dspace-cli config:set https://demo.dspace.org/server
dspace-cli config:verify
dspace-cli config:show
dspace-cli login
dspace-cli login:status
dspace-cli config:reset
dspace-cli login:reset
dspace-cli items:list
dspace-cli items:show <itemId>
dspace-cli items:update <itemId> '[{"op":"add","path":"/metadata/dc.title","value":[{"value":"New Title"}]}]'
dspace-cli collections:list
dspace-cli bitstreams:add <itemId> <filename> <filePath>
dspace-cli bitstreams:delete <bitstreamId>
dspace-cli items:move <itemId> <collectionId>
Run dspace-cli --help or any subcommand with --help for a full list of available commands and options.
See the examples directory for practical usage examples of this library.
// Use import for ESM (add "type": "module" to package.json)
import {dspaceApi} from 'dspace-rest'
// Or for CommonJS:
// const { dspaceApi } = require('dspace-rest')
// Initialize client
dspaceApi.init('http://localhost:8080/server')
dspaceApi.core.info().then((info) => {
console.log(info)
})
dspaceApi.auth.login('admin@example.edu', 'password').then((result) => {
console.log(`Login result: ${result}`)
})
dspaceApi.communities.top().then((communities) => {
const communityList = topCommunitiesResponse._embedded.communities
communityList.forEach((community) => {
console.log(community.name)
})
})
// More examples:
// https://github.com/semanticlib/dspace-rest/tree/main/examples
This package exports all DSpace REST API types through a Types namespace. You can use these types in your TypeScript
code:
import {dspaceApi, Types} from 'dspace-rest'
async function showCollections() {
try {
const res: Types.Communities = await dspaceApi.communities.top()
const commList: Types.Community[] = res._embedded.communities
for (const comm of commList) {
console.log(`${comm.name} (id: ${comm.uuid})`)
// Using the exported Types.Collections type
const res2: Types.Collections = await dspaceApi.collections.byComId(comm.uuid)
const colList: Types.Collection[] = res2._embedded.collections
if (colList.length) {
console.log('\t=> Collections')
colList.forEach(col => {
console.log(`\t${col.name} (id: ${col.uuid})`)
})
}
}
} catch (e) {
console.error('Error in getting collections')
}
}
Available types include:
Types.ApiInfoTypes.CommunityTypes.CommunitiesTypes.SubCommunitiesTypes.CollectionTypes.CollectionsTypes.ItemTypes.ItemsTypes.BitstreamTypes.BitstreamsTypes.BundleTypes.BundlesTypes.DspaceEntityTypes.ListResponseFAQs
DSpace REST API Client for Node.js
We found that dspace-rest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.