This project was replaced by contensis-delivery-api.
You can still use it with all versions of Contensis 11.3 and below. The repo contensis-delivery-api also supports Contensis 11.3 and all the versions after 11.3.
Contensis JavaScript Delivery API implementation written in TypeScript.
This allows the querying and retrieval of entries, content types and projects in JavaScript.
It can be used in any ES2015 compatible project.
- Angular
- React
- React Native
- NativeScript
The Contensis JavaScript Delivery API can be installed using npm.
npm install -save contensis/api-delivery-js
Using ES2015 async/await
import { Client } from 'api-delivery-js';
let contensisConfig = {
rootUrl: 'https://my-cms.com',
accessToken: 'MY_DELIVERY_API_ACCESS_TOKEN',
projectId: 'MY_PROJECT_ID',
language: 'en-GB',
versionStatus: 'published',
pageSize: 50
};
async function loadMovies() {
let client = Client.create(contensisConfig);
let movieList = await client.entries.list({
contentTypeId: 'movie',
pageOptions: { pageIndex: 0, pageSize: 10 },
orderBy: ['-releaseDate']
});
console.log(movieList.items);
}
loadMovies();
Using Promises
import { Client } from 'api-delivery-js';
let contensisConfig = {
rootUrl: 'https://my-cms.com',
accessToken: 'MY_DELIVERY_API_ACCESS_TOKEN',
projectId: 'MY_PROJECT_ID',
language: 'en-GB',
versionStatus: 'published',
pageSize: 50
};
function loadMovies() {
let client = Client.create(contensisConfig);
client.entries.list({
contentTypeId: 'movie',
pageOptions: { pageIndex: 0, pageSize: 10 },
orderBy: ['-releaseDate']
}).then(movieList => {
console.log(movieList.items);
});
}
loadMovies();
Read our documentation on the Contensis Javascript Delivery API to learn of all it's features.