npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cascade-cms-api

v1.0.8

Published

A Javascript library for the Cascade CMS API

Downloads

94

Readme

Cascade CMS API Library

Other Resources

Cascade Conference 2024
Click here if you're looking for UNCW's presentation (The API Awakens: Unleashing Effeciency with Cascade) resources from the 2024 Cascade Conference.

Cascade CMS Tools
Check out my other library cascade-cms-tools

Cascade Documentation

Please note this library is a work in progress. If you come across a bug please open an issue.

A JavaScript library for the Cascade CMS API. You can find more information about their API here: https://www.hannonhill.com/cascadecms/latest/developing-in-cascade/rest-api/index.html#Operations

Available for Cascade CMS v8.1.1 and later.

You can find an openAPI representation of the Cascade library here:

https://kuklaph.github.io/cascade-cms-api/swagger-ui/

Cascade provides in tandem with the REST API docs listed above, a WSDL operations page. In order to access this you will need to use your organization as a subdomain followed by this url:

cascadecms.com/ws/services/AssetOperationService?wsdl

Example: isSandActuallySandy.cascadecms.com/ws/services/AssetOperationService?wsdl

Install

This can be used either via NodeJS or Google Apps Script.

Either download/Copy the files and extract the zip or use npm npm i cascade-cms-api or npm ci cascade-cms-api depending on what you prefer.

General Usage

NodeJS

In your project file import the Cascade API.

import { CascadeAPI, Types } from "cascade-cms-api";

Google Apps Script

In order to use this library within a Google Apps Script (GAS) project you will need to copy the main.js and paste the contents as a new .gs file in your project.

To use the library you will need to instantiate the CascadeAPI function and pass it a config object with your apiKey and a Cascade CMS API URL with your custom domain:

{ apiKey: "", url: "" }

const cascadeAPI = CascadeAPI({
  apiKey: "",
  url: "https://isSandActuallySandy.cascadecms.com/api/v1/",
});

The apiKey is generated in your Cascade dashboard. The url is yourOrg.cascadecms.com/api/v1/ (this is the current version as of 1/9/2023).

If you are using this in Google Apps Script the async/await pattern is not used/required. GAS does not follow this pattern.

// Apps Script
// const cascadeAPI = CascadeAPI_({apiKey: "", url: ""})

// Nodejs
const cascadeAPI = CascadeAPI({
  apiKey: "",
  url: "https://isSandActuallySandy.cascadecms.com/api/v1/",
});

const readFile = async () => {
  const results = await cascadeAPI.read({
    identifier: {
      type: "page",
      id: "d3631e59ac1easd2434bd70be3fbfe8148abc",
    },
  });
  //...
};

Types are optional. You can add type definitions which may be helpful depending on the situation:

// Opt1 - inline
const read = await cascadeAPI.read({
  identifier: {
    type: "page", // inline gives you intellisense
    id: "d3631e59ac1easd2434bd70be3fbfe8148abc",
    //...
  },
});

// Opt2 - add external type
/**
 * @type {Types.EntityTypeString}
 */
const type = "page";
const read = await cascadeAPI.read({
  identifier: {
    type, // uses type from above and you get intellisense within the variable above
    id: "d3631e59ac1easd2434bd70be3fbfe8148abc",
    //...
  },
});

A built in retry is offered for the Nodejs version. The default allotted timeout time is 30 seconds. You can adjust whether or not to use a retry (the default is true) per request method as an optional parameter. If you want to update the timeout time, you can pass in an optional timeout parameter when instantiating CascadeAPI.