Socket
Socket
Sign inDemoInstall

kentico-cloud-content-management

Package Overview
Dependencies
8
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kentico-cloud-content-management

Official Kentico Cloud Content management SDK


Version published
Weekly downloads
15
increased by650%
Maintainers
1
Install size
10.1 MB
Created
Weekly downloads
 

Readme

Source

Kentico Cloud Content management javascript SDK

Javascript SDK for the Kentico Cloud Content Management API. Helps you manage content in your Kentico Cloud projects. Supports both node.js and browsers.

npm version Build Status CircleCI npm Forums Known Vulnerabilities GitHub license Gzip bundle

Getting started

To get started, you'll first need to have access to your Kentico Cloud project where you need to enable Content management API and generate access token that will be used to authenticate all requests made by this library.

Installation

This library has a peer dependency on rxjswhich means you need to install it as well. You install it using npm or use it directly in browser using one of the cdn bundles.

npm
npm i rxjs --save
npm i kentico-cloud-content-management --save
Using a standalone version in browsers

If you'd like to use this library directly in browser, place following script tags to your html page. You may of course download it and refer to local versions of scripts.

<script src="https://cdn.jsdelivr.net/npm/rxjs/bundles/rxjs.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/kentico-cloud-content-management/_bundles/kentico-cloud-cm-sdk.umd.min.js"></script>

Making the first request

The following code example shows how to create new content item in your Kentico Cloud project.

import { ContentManagementClient } from 'kentico-cloud-content-management';

const client = new ContentManagementClient({
        projectId: 'xxx', // id of your Kentico Cloud project
        apiKey: 'yyy', // Content management API token
    });

    client.addContentItem()
        .withData(
            {
                name: 'New article',
                type: {
                    codename: 'article' // codename of content type
                }
            }
        )
        .toObservable()
        .subscribe((response) => {
            // work with response
        },
        (error) => {
            // handle error
        });

If you are using UMD bundles directly in browsers, you can find this library under KenticoCloudContentManagement global variable.

<!DOCTYPE html>
<html>
<head>
	<title>Kentico Cloud CM | jsdelivr cdn</title>
    <script src="https://cdn.jsdelivr.net/npm/rxjs/bundles/rxjs.umd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/kentico-cloud-content-management/_bundles/kentico-cloud-cm-sdk.umd.min.js"></script>
</head>
<body>
    <script type="text/javascript">
        var CM = window['KenticoCloudContentManagement'];

		var client = new CM.ContentManagementClient({
			projectId: 'xxx',
			apiKey: 'yyy'
		});

		client.addContentItem()
            .withData(
                {
                    name: 'New article',
                    type: {
                        codename: 'article'
                    },
                }
            )
            .toObservable()
            .subscribe((response) => {
                // work with response
            },
            (error) => {
                // handle error
            });
	</script>
</body>
</html>

Configuration

The ContentManagementClient contains several configuration options:

const client = new ContentManagementClient({
    // configuration options
});
OptionDefaultDescription
projectIdN/ARequired - Id of your Kentico Cloud project
apiKeyN/ARequired - Content management API Token
baseUrlhttps://manage.kenticocloud.com/v2/projectsBase URL of REST api. Can be useful if you are using custom proxy or for testing purposes
retryAttempts3Number of retry attempts when error occures. To disable set the value to 0.
httpServiceHttpServiceUsed to inject implementation of IHttpService used to make HTTP request across network. Can also be useful for testing purposes by returning specified responses.
retryStatusCodes[500]Array of request status codes that should be retried.

API Reference

Online API Reference documents latest version of this library and can be used to quickly find all exposed methods and objects. Documentation is generated from TypeScript code and thus it should always be accurate.

Testing

If you want to mock http responses, it is possible to use external implementation of configurable Http Service as a part of the client configuration.

Troubleshooting & feedback

If you have any issues or want to share your feedback, please feel free to create an issue in this GitHub repository.

Contributions

Contributions are welcomed. If you have an idea of what you would like to implement, let us know and lets discuss details of your PR.

Keywords

FAQs

Last updated on 09 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc