Registry / devops / oae-rest

oae-rest

JSON →
library14.0.0jsnpmunverified

Open Academic Environment (OAE) REST client library for communicating with OAE instances via REST endpoints. Version 14.0.0 (Node >=6.11.1) is the latest stable release, versioned in sync with the Hilary project. Each release is post-fixed with -N for maintenance. Key differentiator: standalone module for programmatic access to OAE REST APIs, not a client SDK for alternative frameworks.

npm install oae-rest
INSTALL
IMPORT
SIG · OAE-REST
O
oae-rest
devopsjavascriptv14.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OaeRest
import OaeRest from 'oae-rest'
const OaeRest = require('oae-rest')
Default import; CommonJS require also works but TypeScript prefers ES modules.
OaeRestApi
import OaeRestApi from 'oae-rest/api'
import { OaeRestApi } from 'oae-rest'
Submodule for API endpoints; named export not available from main entry.
RestClient
import { RestClient } from 'oae-rest'
const RestClient = require('oae-rest').RestClient
Named export for creating a client instance.

Creates a RestClient, authenticates with tenant alias and credentials, then fetches user info.

import OaeRest from 'oae-rest'; import { RestClient } from 'oae-rest'; const host = 'http://localhost:3000'; const client = new RestClient(host); const tenantAlias = 'mydomain'; const username = 'admin'; const password = process.env.OAE_PASSWORD ?? 'password'; async function loginAndGetInfo() { try { const loginResult = await client.post(tenantAlias, username, password); console.log('Logged in:', loginResult); const info = await client.get('/api/me'); console.log('User info:', info); } catch (err) { console.error('Error:', err.message); } } loginAndGetInfo();
Debug
Known issues
breakingBreaking change: In v9.0.0, the constructor signature changed from `new RestClient(host, options)` to `new RestClient(host)`, with options moved to methods.
fix
Pass options (e.g., headers) via individual method calls instead of constructor.
affects: >=9.0.0
deprecatedThe `login` method is deprecated in favor of `post(tenantAlias, username, password)` since v10.0.0.
fix
Use `client.post(tenantAlias, username, password)` instead of `client.login(tenantAlias, username, password)`.
affects: >=10.0.0
gotchaThe `oauth` endpoint in v12.0.0+ returns a different token structure; previous `access_token` is now inside `token` object.
fix
Access token via `response.token.access_token` instead of `response.access_token`.
affects: >=12.0.0
deprecatedThe `get` and `post` methods now require an explicit tenant alias for tenant-scoped endpoints since v11.0.0; omitting it returns a 400 error.
fix
Always pass tenantAlias as first argument to `get` and `post` when calling tenant-specific routes.
affects: >=11.0.0
breakingNode.js < 6.11.1 no longer supported after v13.0.0; older versions may cause TLS errors.
fix
Upgrade Node.js to >=6.11.1.
affects: >=13.0.0
Errors
Common errors & fixes
TypeError: OaeRest is not a function
Using default import as a constructor instead of importing RestClient.
fix
Use `new RestClient(host)` after `import { RestClient } from 'oae-rest'`.
Error: Cannot find module 'oae-rest/lib/util'
Importing internal modules not part of public API.
fix
Use only documented exports from 'oae-rest' or 'oae-rest/api'.
Response { status: 400, message: 'Missing required parameter: tenantAlias' }
Omitting tenantAlias in v11+ methods.
fix
Pass tenantAlias as first argument to `get` and `post`.
Upgrade
Version history
14.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
12
Amazon
1
Resources
oae-rest — npm install oae-rest · libregistry