Client Javascript library (node and browser) for Appyay Content Management API.
To get started with the Appyay Management JS SDK you'll need to install it, and then get credentials which will allow you to access your content in Appyay.
npm i
This library is still in development and not yet available on NPM.
import {createClient} from "appyay-management-js";
const client = createClient({
environmentId: '<environment_id>',
accessToken: '<access_token>', //for write access
apikey: '<api_key>' //for read access
});
<script src="path/to/appyay-delivery-js/dist/appyay-management.browser.js"></script>
Accessing the global variable:
const client = appyayManagement.createClient({
environmentId: '<environment_id>',
accessToken: '<access_token>', //for write access
apikey: '<api_key>' //for read access
});
client.getContentTypes()
.then(function(response){
console.log('content types retrieved', response.contentTypes);
});
client.getContentType(contentTypeId)
.then(function(response){
console.log('content type retrieved', response.id);
});
client.getItems(contentTypeId)
.then(function(response){
console.log('items retrieved', response.items);
});
client.getItem(itemId)
.then(function(item){
console.log('item retrieved', item);
});
client.createItem(contentTypeId, {
fields: {
title: 'New post'
},
status: 'published'
})
.then(function(item){
console.log('item created', item);
});
contentType.getItems()
.then(function(response){
console.log('items retrieved', response.items);
});
contentType.delete();
contentType.addItem({
fields: {
title: 'New post'
},
status: 'published'
})
.then(function(response){
console.log('items retrieved', response.items);
});
let title = 'Updated post';
item.fields.title = title;
item.update();
item.delete();
Browsers and Node.js:
- Chrome
- Firefox
- Edge
- Safari
- node.js (6.x, 8.x)
node <path_to_appyay-management-js>/test/integration/index.js
If you have a problem with this library, please file an issue here on GitHub.