New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

ninoxjs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ninoxjs

a simple and fast wrapper for the Ninox REST API

Source
npmnpm
Version
1.0.7
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

‘npm version’ ‘downloads over month’

ninox.js

What is this?

This is a simple JavaScript wrapper for Ninox API. This allows you to easily use Ninox API in your JavaScript code without needing to write REST API Calls.

Install

npm install ninoxjs --save

Example

const ninox = require('ninoxjs');

ninox.auth({
    authKey: 'YOUR_AUTH_KEY',
    team: 'YOUR_TEAM_NAME',
    database: 'YOUR_DATABASE_NAME'
}).getRecords('YOUR_TABLE_NAME', [{
	name: 'John'
}], ['name', 'age']).then(function(records) {
    console.log(records);
});

auth() must be called once before using the API. It returns a Promise that resolve to itself so you can chain commands.

Available methods

getRecords

Retrieves all Records from the Table that match the filters.

Usage:

ninox.getRecords(
	'YOUR_TABLE_NAME', // Table name
    [{
        name: 'John' // Filter
    }],
    ['name', 'age'] // Fields to retrieve
);

getRecord

Returns a record from a table by id

Usage:

ninox.getRecord("YOUR_TABLE_NAME", 123).then(function(record) {
        console.log(record);
    }
)

saveRecords

Saves Records to a table in the database, omitting the id will create a new record, with the id will update the record

Usage:

ninox.saveRecords("YOUR_TABLE_NAME", [{
	id: "1",
	fields: {
		field1: "value1",
		field2: "value2"
	},
}]);

deleteRecord

Deletes Records from a table in the database.

Usage:

ninox.deleteRecord("YOUR_TABLE_NAME", 123);

deleteRecords

Deletes all Records from a table in the database (very slow, since it deletes all records with individual API calls).

Usage:

ninox.deleteRecord("YOUR_TABLE_NAME", [123, 124, 125]);

Keywords

ninox

FAQs

Package last updated on 28 Jun 2022

Related posts