Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dotcms/client

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotcms/client

Official JavaScript library for interacting with DotCMS REST APIs.

  • 0.0.1-alpha.48
  • alpha
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63
decreased by-83.29%
Maintainers
0
Weekly downloads
 
Created
Source

@dotcms/client

@dotcms/client is the official dotCMS JavaScript library designed to simplify interactions with the DotCMS REST APIs.

This client library provides a streamlined, promise-based interface to fetch pages and navigation API.

Features

  • Easy-to-use methods to interact with the DotCMS Page and Navigation APIs.
  • Support for custom actions to communicate with the DotCMS page editor.
  • Comprehensive TypeScript typings for better development experience.

Installation

Install the package via npm:

npm install @dotcms/client

Or using Yarn:

yarn add @dotcms/client

Usage

@dotcms/client supports both ES modules and CommonJS. You can import it using either syntax:

ES Modules

import { DotCmsClient } from '@dotcms/client';

CommonJS

const { DotCmsClient } = require('@dotcms/client');

First, initialize the client with your DotCMS instance details.

const client = DotCmsClient.init({
    dotcmsUrl: 'https://your-dotcms-instance.com',
    authToken: 'your-auth-token',
    siteId: 'your-site-id'
});

Fetching a Page

Retrieve the elements of any page in your DotCMS system in JSON format.

const pageData = await client.page.get({
    path: '/your-page-path',
    language_id: 1,
    personaId: 'optional-persona-id'
});

console.log(pageData);

Fetching Navigation

Retrieve information about the DotCMS file and folder tree.

const navData = await client.nav.get({
    path: '/',
    depth: 2,
    languageId: 1
});

console.log(navData);

API Reference

Detailed documentation of the @dotcms/client methods, parameters, and types can be found below:

DotCmsClient.init(config: ClientConfig): DotCmsClient

Initializes the DotCMS client with the specified configuration.

DotCmsClient.page.get(options: PageApiOptions): Promise<unknown>

Retrieves the specified page's elements from your DotCMS system in JSON format.

DotCmsClient.nav.get(options: NavApiOptions): Promise<unknown>

Retrieves information about the DotCMS file and folder tree.

Contributing

GitHub pull requests are the preferred method to contribute code to dotCMS. Before any pull requests can be accepted, an automated tool will ask you to agree to the dotCMS Contributor's Agreement.

Licensing

dotCMS comes in multiple editions and as such is dual licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds a number of enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see the feature page.

Support

If you need help or have any questions, please open an issue in the GitHub repository.

Documentation

Always refer to the official DotCMS documentation for comprehensive guides and API references.

Getting Help

SourceLocation
InstallationInstallation
DocumentationDocumentation
VideosHelpful Videos
Forums/Listservvia Google Groups
Twitter@dotCMS
Main SitedotCMS.com

Keywords

FAQs

Package last updated on 12 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc