Product

Plattar API product Reference

Parent
Imports
NodeJS Imports
const {
  	Project,
  	Product,
  	Server
} = require('@plattar/plattar-api');
Initialisation
Initialise the Product Object
const product = new Product('your-product-id');
.get()
Populate the object with data
product.get().then((product) => {
	// do something with product
}).catch((error) => {
	// do something with error
});
.update()
Update the object with new data
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

product.attributes.title = 'your-new-product-title';

product.update().then((product) => {
	// do something with product
}).catch((error) => {
	// do something with error
});
.create()
Create a new object
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

product.attributes.title = 'your-new-product-title';

// you must pass the parent object during create function
const parent = new Project('your-project-id');

product.create(parent).then((product) => {
	// do something with product
}).catch((error) => {
	// do something with error
});
.delete()
Delete a previous object
Server.default().auth(process.env.PLATTAR_AUTH_TOKEN);

product.delete().then((product) => {
	// do something with product
}).catch((error) => {
	// do something with error
});