To use the Plattar API SDK you must first Install NodeJS and NPM for your operating system. This Guide will walk though how to setup a fresh NodeJS project, install the plattar-api module and interface with the Plattar API.

Validate if NodeJS and NPM are installed
node -v
npm -v
Create a new folder for our project
mkdir plattar-project
cd plattar-project
Initialise a default node project with default values
npm init --yes
Install the plattar-api package
npm install @plattar/plattar-api
Create an index.js file to execute our code
touch index.js
Copy the following JS code into your index.js file
const {
  Project
} = require('@plattar/plattar-api');

// this is a sample project id created for this demo
const project = new Project('267f1c90-e5b8-11ea-a494-c7a7855ca934');

project.get().then((proj) => {
  // print our project data
  console.log(proj.attributes);
}).catch((error) => {
  console.error(error);
});
Execute your JS code using NodeJS
node .

A successful output like below will print in your console. Congratulations! you’ve successfully interfaced with the Plattar API.

Console output of the sample code
Some data has been removed due to space constraints
{
  "title": "Test Project",
  "theme": "plattarxr/www",
  "..."
}