Skip to main content

Registering the Client

Log in to add to favourites

Install the Delivery API client

Install the contensis-delivery-api package to your project dependencies using npm, or your preferred Node.js package manager.

shell
npm install --save contensis-delivery-api

Import the client

Follow the examples with the preferred coding style that best suits your project

TypeScript
// Using TypeScript, or ES Module syntax
import { Client } from "contensis-delivery-api";
JavaScript
// Using Common JS syntax
const { Client } = require("contensis-delivery-api");

Initialise the client

As a minimum, you need to supply the API root URL, access token, and project ID to initialise the client

Further options can be set that are applied to all requests made from the client instance

Example creating a Delivery API client in JavaScript or TypeScript

TypeScript
const client = Client.create({
  rootUrl: "https://api-<cms-alias>.cloud.contensis.com",
  accessToken: "<environment-access-token>",
  projectId: "<project-api-id>",
});

Next steps

We have a  Delivery API client connected to our CMS, all operations are available from within this client.

If you are new to using the Delivery API you could test your client by trying one of the following articles first before exploring more complex use cases

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request