Milan Lund logo

Hi, I am Milan Lund!Full Stack Web Developer

I specialise in building websites and web applications with and Kentico platforms.


Request Delivery API in Node.js

I've already done a few websites with in Node.js and I would like to share my experience. In this article, I will show you how to request Delivery API in Node.js and provide you with a fully functioning code example.

See live demo on Runkit.

Step by step tutorial

We will use promises in this example. What we need first are npm packages that will help us with that:

  • request
  • request-promise

Then require both packages in your code:


Now we define a class with Project ID and Preview API Key that represent your project:


The class will contain the getContent method that requests the storage and gets content from your project:


We call 2 helper methods in the getContent method:

  • getRawData
  • getOptions

 Let's see what they do:


In the getOptions method, we call one more helper method - getDeliveryUrl. Let's complete that:


At this stage, we have the class and all methods in place. See the usage:


Full code example

Just copy and paste it into your project.  Happy requesting! 


Or see the live demo on Runkit.

If you are looking for code that is able to make multiple requests at a time read the following article: Multiple requests to Delivery API in Node.js