Nexudus API client
Last updated 2 years ago by dennis-alund .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @oddbit/nexudus 
SYNC missed versions from official npm registry.


License NPM version Total NPM downloads Travis build status

An easy to use and Typscript friendly API client for Nexudus.

Admin API

The admin API requires a registered Nexudus "App" and an auth token.

The Nexudus Spaces API allows you to develop Apps and modules that extend the Nexudus Spaces platform. You can implment features that your business may require or even create solutions that can be sold to other Nexudus Spaces customers.

In order to create an App you need a Nexudus account for your business or if you have set up a "test space" for sandbox testing (perhaps you should check first with Nexudus to see what they advice: info@nexudus.com).

Log in to your space and enter the "Apps list" and create an entry for your own App: https://spaces.nexudus.com/Apps/Applications

Select all the permissions that are matching the API endpoints that you intend to be using.


Before you can use the admin API client you must complete an installation request that Nexudus will push to your endpoint when a someone is choosing to activate/install your App.

Please read the official API documentation to learn more about the variables that are passed in the requests.query that is used to initialize AppInstallationRequest in the example below.

Consuming installation request

import * as nexudus from "@oddbit/nexudus";

function apiEndoint(request, response) {
    // Store your secret/public app keys safely somewhere...
    const application = new nexudus.Application(SECRET_APP_KEY, PUBLIC_APP_KEY);

    const installationRequest = new nexudus.AppInstallationRequest(request.query);

    try {
    } catch(err) {
        response.status(401).send("The installation request was not valid");
    const apiAuthToken = application.createAuthToken(installationRequest);

    // ...
    // Store the apiAuthToken somewhere in your database
    // ...
    // Do other stuffs
    // ...

    response.status(200).send("Install succsess!");

Fetch all businesses

In the example below, we're fetching all Business objects that a certain account. See the documentation the official documentation for how Nexudus is organizing the hierarchy and relationships between businesses, user, coworkers and check-ins.

import * as nexudus from "@oddbit/nexudus";

const apiClient = new nexudus.AdminApiClient(apiAuthToken);
const nexudusBusinessList = await apiClient.getBusinesses();
nexudusBusinessList.forEeach(nexudusBusiness => {
    console.log(`Got business '${nexudusBusiness.Name}' with id: ${nexudusBusiness.Id}`);

Fetch businesses and filter results

Currently it's only supported to filter the results by "time of update", which allows you to only fetch records that has been updated after a certain point in time.

const timestamp = new Date(2015, 3, 1);
const nexudusBusinessList = await apiClient.getBusinesses({updatedAfter: timestamp.getTime()});

Fetch single businesses

// You must know the Nexudus ID of the business
const nexudusBusiness = await apiClient.getBusiness(12345);


The API client will perform an update if the data object contains an Id. The operation will fail if Nexudus does not know of any corresponding object with that id (i.e. if it hasn't been created yet).

const nexudusBusiness = {
   "Id": 123456,
   "Name": "Kumpul Coworking Space",
   "WebAddress": "https://www.kumpul.co"
} as nexudus.Business;
await apiClient.saveBusiness(nexudusBusiness);


The API client will create a new record at Nexudus if there is no Id attribute present.

const nexudusBusiness = {
   "Name": "Kumpul Coworking Space",
   "WebAddress": "https://www.kumpul.co"
} as nexudus.Business;
await apiClient.saveBusiness(nexudusBusiness);


// You must know the Nexudus ID of the business
await apiClient.deleteBusiness(12345);

Public API

The public API is designed to work with the public resources of the space and also member restricted resources. The API is using the member's email and password for authentication, which makes it easier to use and apply in your application. But it is also restricted in its powers. You can't do things like "check in" or "check out".


In the example below, we're fetching the Coworker object of the user "john.doe@example.com" at Nexudus. See the documentation on the difference between "User" and "Coworker" at Nexudus's API documentation.

The API client is throwing a HTTP 401 error if username or password is wrong.

import * as nexudus from "@oddbit/nexudus";

const apiClient = new nexudus.PublicApiClient("kumpul", "john.doe@example.com", "secretPassword");

try {
    const nexudusCoworker = await apiClient.getCoworker();
} catch (err) {
    console.log(`You just got yourself a HTTP ${err.statusCode} error: ${err.message}`);

Current Tags

  • 0.2.9                                ...           latest (2 years ago)

10 Versions

  • 0.2.9                                ...           2 years ago
  • 0.2.8                                ...           2 years ago
  • 0.2.7                                ...           2 years ago
  • 0.2.6                                ...           2 years ago
  • 0.2.5                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 6
Last Day 0
Last Week 0
Last Month 7
Dependencies (6)
Dev Dependencies (6)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |