Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-directus-client

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-directus-client

A JavaScript client for the Directus API

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Directus API JavaScript Client

A JavaScript client for the Directus API

This library is under active development. Breaking changes can occur at every patch.

Purpose

This libraries abstracts the interaction with the Directus CMS API. It enables your Node.js app to request specific resources from a Directus instance.

Installation

To use the library, install it with npm: npm install --save node-directus-client

Then require it in your application script: const DirectusSDKClient = require('node-directus-client')

Usage

The module is a class, so you'll have to create a new instance of the client bound to the endpoint and access token of your Directus instance. This can either be a self-hosted Directus installation or a hosted Directus instance.

Self-hosted

const client = new DirectusSDKClient('apiKey-12345', {
  baseURL: 'http://yoursite.com/api/'
});

Hosted

const client = new DirectusSDKClient('apiKey-12345', {
  instanceKey: 'instance_key'
});

Every method (see below) is asynchronous and can be used with callbacks as well as promises.

client.getTables()
  .then((res) => {
    console.log(res);
  });

client.getTables(function(err, res) {
  console.log(res);
});

Methods (endpoints)

The options object will be converted to query params in the api request. Check the official Directus API endpoints docs for all available options.

getTables

client.getTables([_obj_ options, _fn_ callback])

Get all available tables.

getColumns

client.getColumns(_string_ table, [_obj_ options, _fn_ callback])

Get all columns from a single table.

getEntry

client.getEntry(_string_ table, _int_ id, [_obj_ options, _fn_ callback])

Get a single item from a table

getEntries

client.getEntries(_string_ table, [_obj_ options, _fn_ callback])

Get multiple items from a table

getUser

client.getUser(_int_ id, [_obj_ options, _fn_ callback])

Get a single user

getUsers

client.getUsers([_obj_ options, _fn_ callback])

Get all users

More methods will be added over time, including methods to update and post entries

FAQs

Package last updated on 10 Nov 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc