Giter Club home page Giter Club logo

oracle / content-management-sdk Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 8.0 92 KB

JavaScript package to make it easier to use content (digital assets, structured content) from Oracle Content Management

Home Page: https://docs.oracle.com/en/cloud/paas/content-cloud/headless-cms.html

License: Universal Permissive License v1.0

JavaScript 100.00%
oracle-content-management oracle-content-experience javascript nodejs cms headless-cms oracle-cloud

content-management-sdk's Introduction

About Oracle Content Management - Content SDK (JavaScript)

The Content SDK for Oracle Content Management is a light-weight JavaScript wrapper that interacts with the Content REST APIs. This read-only SDK retrieves structured content, digital assets and content layouts that are managed in Oracle Content Management. The SDK allows you to write a web application that is content rich - allowing the use of Oracle Content Management for content management, authoring and approval and delivery from your own web server.

The SDK consists of three main classes:

  • contentSDK: The main entry-point object. The contentSDK object lets you create client objects to access content based on your requirements.
  • ContentDeliveryClient : A client object that is set up to access published content items and digital assets.
  • ContentPreviewClient : A client object that is set up to access content types, draft content items, and draft digital assets.

Installation

Prerequisite: node.js 10.9.0 or later, and node and npm on your path.

npm install @oracle/content-management-sdk

Documentation

Examples

NOTE: The SDK must be initialized with the URL of your content service. The URL uses the pattern https://<service-name>-<account-name>.cec.ocp.oraclecloud.com and can be given to you by your Oracle Content Management service administrator.

Using the SDK in NodeJS with ES6 import

// Imports the contentSDK class. You could import the createDeliveryClient or createPreviewClient functions instead.
import { contentSDK }  from '@oracle/content-management-sdk';

const contentDeliveryClient = contentSDK.createDeliveryClient({
  contentServer: 'https://<service-name>-<account-name>.cec.ocp.oraclecloud.com',
  contentVersion: 'v1.1',
  channelToken: '<token>', // Use your published channel token
  logger: console,
});

// Perform a load of an asset
contentDeliveryClient.getItem(....);

Using the SDK in NodeJS with require

// Imports the contentSDK class. You could import the createDeliveryClient or createPreviewClient functions instead.
const contentSDK = require('@oracle/content-management-sdk');

const contentDeliveryClient = contentSDK.createDeliveryClient({
  contentServer: 'https://<service-name>-<account-name>.cec.ocp.oraclecloud.com',
  contentVersion: 'v1.1',
  channelToken: '<token>', // Use your published channel token
  logger: console,
});

// Perform a load of an asset
contentDeliveryClient.getItem(....);

Using the SDK with import in an HTML page

<html>  
  <head>  
    <script type="module">
      import {createDeliveryClient} from 'path_to_expanded_contentsdk_package/content.umd.js';
      const client=createDeliveryClient({  
        contentServer: 'https://<service-name>-<account-name>.cec.ocp.oraclecloud.com',  
        contentVersion: 'v1.1',  
        channelToken: '<token>',
        logger: console,  
      });  
      client.getItem(....);
    </script>  
  </head>  
  <body>  
  </body>  
</html>  

Loading the SDK via a script tag

<html>
  <head>
      <title>Using Content SDK</title>
      <script src="url_of_expanded_contentsdk_package/content.umd.js"></script>
  </head>
  <body>
    <script>
      const client = contentsdk.createDeliveryClient({
        contentServer: 'https://<service-name>-<account-name>.cec.ocp.oraclecloud.com',
        contentVersion: 'v1.1',
        channelToken: '<token>',
        logger: console,
      });
      client.getItem(....);
    </script>
  </body>
</html>

Sample Projects

For more examples, check out our open source sample projects.

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide.

Security

Please consult the security guide for our responsible security vulnerability disclosure process.

License

Copyright (c) 2017, 2022, Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.

content-management-sdk's People

Contributors

kmacdonao avatar spavlusieva avatar tcaruth avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

content-management-sdk's Issues

[Docs] channelToken

For new comer like me to have a fast-start, it seems like no way to understand what is channelToken in the API or how can we get it?
Does it mean the one generated from OAuth?

SDK should support Business Repositories

I am attempting to use the content SDK on a business repository but a required parameter is the channelToken. However business repos do not have channels. Is this something that can be supported by the SDK?

Append channelToken automatically during local development

I'm using the content sdk through the OCM toolkit, and my graphql calls are failing because there isn't a channel token set as a query parameter. I'll submit a pull request with a possible solution, but feel free to let me know if there's a preferred way to do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.