By using this website you implicitly accept our cookies. For more informations read our Cookie policy

NodeJS Quickstart

Create a Marketcloud application

A Marketcloud account is required

In order to create an application, you need to create a Marketcloud account first.

Create an account

Create an application

An application is where your store's data will live. Simply create one choosing an application name and a plan. We’ve got several plans including our favorite, Free!

Create your first product

Add data using the dashboard

Once you created your application you can log into its dashboard just by clicking on it. Here you can open the "products" section and create your first product You can also add images and variants!

Bootstrap your frontend

Install the SDK

The easiest way to install the NodeJS SDK is using NPM:

npm install marketcloud-node

But you can also clone from GitHub:

git clone https://github.com/Marketcloud/marketcloud-node.git

At this point you are ready to require it into your application

var Marketcloud = require('marketcloud-node');

Configure the client

In order to query the API, you must set your application's public key into the client, You can find the public key under the "information" section.

var marketcloud = new Marketcloud.Client({
	"public_key" : "your-public-key",
	"secret_key" : "your-secret-key"
})

Query the API

Use the NodeJS client

Congratulations you are ready to query the API! Use the client to retrieve the product you created earlier:


marketcloud.products.list({})
.then(function(product){
  // Handle success
})
.catch(function(error){
  // Handle the error
})
				

The code above will retrieve a paginated list of products, you can also use the first parameter to filter them by any key. For example, assuming that we added some books with a "author" property to the application, we could easily retrieve books writter by George Martin:


var query = { author : "George Martin", category_id : 111};
marketcloud.products.list(query)
.then(function(product){
  // Handle success
})
.catch(function(error){
  // Handle the error
})
				

Well done!

You have a Marketcloud powered application!

In these 5 little steps you obtained:

  • Full featured dashboard to manage your store

  • Infinite frontend flexibility

  • A fast and scalable backend for your eCommerce applications

Now you can add more features to your app by checking the documentation, or you can spend more time on the dashboard adding more stuff!

Questions?

We're super happy to help with any question you might have! Send us an email, or get in touch with us in our Slack channel !